返回顶部

收藏

C#通过List类实现动态变长数组

更多
class Person
{
    public string Name { get; set; }
    public string Address { get; set; }
}

static void Main(string[] args)
{
    List<Person> people = new List<Person>();
    people.Add(new Person()
                 { 
                      Name = "kaka", 
                      Address = "22,2nd cross,bangalore" 
                  });
   //no casting needed
    Person p = people[0];
}

标签:list,动态数组,C#

收藏

0人收藏

支持

0

反对

0

发表评论