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

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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];
}