How to Use T [] or List <T> in C,
If a group of data needs to be stored, does it use T [] or select List <T>?
First, let's look at the array.
All Array types are implicitly derived from the abstract class System. Array, and System. Array is derived from System. Object. That is to say, the array is of reference type. Create an array as follows:
Int [] arrInt = new int [10];
The above memory blocks are allocated on the hosting stack to accommodate 10 unboxed int objects (this memory block can accommodate the memory occupied by array elements, it also includes the type object pointer of the array element object, synchronization block index and other additional members), and then the memory block address is returned and saved to the arrInt variable on the thread stack.
In fact, an array is maintained internally, but the size of the array can be dynamically increased. As mentioned here.
Summary: if the data capacity changes dynamically, You need to perform operations, such as inserting or deleting elements, use List <T>. If the data capacity is fixed, you can consider using T [].