【发布时间】:2016-08-14 10:58:59
【问题描述】:
当我这样做时:
List<Person> person = new List<Person>();
person.Print();
我什么都没得到(null)
但是,当我这样做时:
Person[] person2 = new person[10];
person2.Print();
我得到一个例外。
为什么?内存中发生了什么?没看懂。
【问题讨论】:
-
向我们展示
Print方法。 -
new person[10];应该是new Person[10];。 -
没有
List<T>.Print或Array.Print方法。它从何而来?它是一种扩展方法吗?如果有,在哪里? -
很可能是一种扩展方法
-
但是你的标题很糟糕