2011/09/09(Fri) 15:51:22 編集(投稿者)
ここを読んでみてください
http://www.atmarkit.co.jp/fdotnet/special/generics01/generics01_01.html
[追記]
ヒント:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
List<Test> list = new List<Test>();
Test ts = new Test("AAA", "BBB");
list.Add(ts);
MessageBox.Show(list[0].Hoge2);
}
}
class Test
{
private string tHoge;
private string tHoge2;
public Test(string hoge, string hoge2)
{
tHoge = hoge;
tHoge2 = hoge2;
}
public string Hoge
{
get { return tHoge;}
set{ tHoge = value;}
}
public string Hoge2
{
get { return tHoge2; }
set { tHoge2 = value; }
}
}