public class student
{
private string _name; public string Name
{
get { return _name; }
set { _name = value; }
}
private int _age; public int Age
{
get { return _age; }
set { _age = value; }
}
private Dictionary<string, student> _item; public Dictionary<string, student> Item
{
get { return _item; }
set { _item = value; }
}
public student(string _name,int _age,Dictionary<string ,student> _item)
{
this.Name = _name;
this.Age = _age;
this.Item = _item;
}
} private void Form1_Load(object sender, EventArgs e)
{ }
那么做属性的那个范型集合可以嘉甚么呀?
外面用的时候也要定义一字典范型集合、怎么添加?
{
private string _name; public string Name
{
get { return _name; }
set { _name = value; }
}
private int _age; public int Age
{
get { return _age; }
set { _age = value; }
}
private Dictionary<string, student> _item; public Dictionary<string, student> Item
{
get { return _item; }
set { _item = value; }
}
public student(string _name,int _age,Dictionary<string ,student> _item)
{
this.Name = _name;
this.Age = _age;
this.Item = _item;
}
} private void Form1_Load(object sender, EventArgs e)
{ }
那么做属性的那个范型集合可以嘉甚么呀?
外面用的时候也要定义一字典范型集合、怎么添加?
2.注意同步
Student xm = new Student();
Student xw = new Student();s.Add("小明", xm);
s.Add("小文", xw);