阅读背景:

关于引用/集合/值类型的另一个C#问题

来源:互联网 

I have the following code:

我有以下代码:

public class Test
{
    public static void Main()
    {
        List<Person> list = new List<Person>();
        Person person = new Person() { Name="Chris" };
        list.Add(person);

        person = new Person(){ Name="Wilson the cat" };
        list.Add(person);

        Console.WriteLine(list[0].Name);
        Console.WriteLine(list[1].Name);
        Console.ReadLine();
    }
}

public class Person
{
    public string Name {get;set;}   
}
public c



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: