using System; namespace Wankuma.IO { /// /// PathBuilderはPathを連結してフルパスを構築するためのBuilderです。 /// public class PathBuilder { private string _result = null; /// /// コンストラクタ /// public PathBuilder() { } /// /// 連結するパス文字列です。 /// /// 連結するパスの名前です public void Append(string path) { if ( path == null ) { throw new ArgumentNullException("path", "pathにnullは指定できません。"); } if ( path == "" ) { throw new ArgumentException("path", @"pathに""は指定できません。"); } if ( this._result == null ) { this._result = path; } else { this._result = System.IO.Path.Combine(this._result, path); } } /// /// 結果を取り出します。 /// /// 連結されたパス文字列 public override string ToString() { return this._result; } } }