using System;
using System.Collections.Generic;
using System.Text;
namespace YokoKen.Test
{
/// <summary>
/// ほげを表すクラス。
/// </summary>
public sealed class Hoge
{
#region フィールド
#region private readonly string name
/// <summary>
/// ほげ名。
/// </summary>
private readonly string name;
#endregion
#region private readonly List<Hoge> childHogeList
/// <summary>
/// 子ほげのコレクション。
/// </summary>
private readonly List<Hoge> childHogeList;
#endregion
#endregion
#region プロパティ
#region public string Name
/// <summary>
/// ほげ名を取得する。
/// </summary>
public string Name
{
get
{
return this.name;
}
}
#endregion
#region public List<Hoge> ChildHogeList
/// <summary>
/// 子ほげのコレクションを取得する。
/// </summary>
public List<Hoge> ChildHogeList
{
get
{
return this.childHogeList;
}
}
#endregion
#endregion
#region コンストラクタ
#region public Hoge(string name)
/// <summary>
/// ほげ名を指定して、Hoge クラスの新しいインスタンスを初期化する。
/// </summary>
/// <param name="name">ほげ名。</param>
public Hoge(string name) : this(name, new List<Hoge>())
{
}
#endregion
#region public Hoge(string name, List<Hoge> childHogeList)
/// <summary>
/// ほげ名と子ほげを指定して、Hoge クラスの新しいインスタンスを初期化する。
/// </summary>
/// <param name="name">ほげ名。</param>
/// <param name="childHogeList">子ほげ。</param>
public Hoge(string name, List<Hoge> childHogeList)
{
this.name = name;
this.childHogeList = childHogeList;
}
#endregion
#endregion
#region メソッド
#region public void Piyo()
/// <summary>
/// ぴよ。
/// </summary>
/// <returns>ぴよぴよ</returns>
public string Piyo()
{
// ぴよぴよを返す。
return "ぴよぴよ";
}
#endregion
#endregion
}
}
トラックバックURL↓
http://csharper.blog57.fc2.com/tb.php/42-0abde357