我基本上要做到这一点代码:我能有一个泛型列表类和揭露,作为默认值
PersonList myPersonList;
//populate myPersonList here, not shown
Foreach (Person myPerson in myPersonList)
{
...
}
类中声明
public class PersonList
{
public List<Person> myIntenalList;
Person CustomFunction()
{...}
}
那么,如何揭露“ myInternalList“作为Foreach语句可以使用的默认值吗?或者我可以吗?原因在于我有大约50个目前正在使用GenericCollection的类,我想迁移到泛型,但不想重写一吨。
你是什么意思的“默认值?” C#没有像VB这样的默认属性。 – 2010-03-05 20:12:08