C#中的list可以当做数组使用,而且无需定义长度,完全是动态的
class Person
{
public string Name { get; set; }
public string Address { get; set; }
}
static void Main(string[] args)
{
List people = new List();
people.Add(new Person()
{
Name = "kaka",
Address = "22,2nd cross,bangalore"
});
//no casting needed #codego.net#
Person p = people[0];
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30122704/viewspace-1486449/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30122704/viewspace-1486449/