C# List<GenericClass>(100) Construction Principles
问题 If I do the following: List<GenericClass> listObj = new List<GenericClass>(100); // Do I need this part too? for (int i = 0; i < 100; i++) { listObj[i] = new GenericClass(); } Basically I am asking if the C# compiler will automatically fire the GenericClass constructor for each of the 100 GenericClass objects in the list. I searched in the MSDN documentation as well as here on StackOverflow. Thanks for any help. 回答1: That's not how List works. When you specify a capacity, it's an initial