Unity Arraylist array

Arraylist array list:


Advantages:
1. There is no need to declare the length of the array (the value of ArrayList objects is dynamically increased and reduced according to the data stored in the photo) 2. Different
types of elements can be stored (ArrayList will treat its elements as Objects) )

Disadvantages:
1.ArrayList is not type safe. Because different types are treated as Objects, it is very likely that type mismatches will occur when using ArrayList.
2. A boxing operation will occur when inserting a value type, and an unboxing operation will occur when an index value is retrieved. (very loss of performance)

Boxing : Pack value type data into instances of reference types
Example: int info =1; object obj=(object)info;
Unboxing : Extract value types from reference data
Example: object o=1; int i= (int)o;

Some methods:

————————————————
Original link: https://blog.csdn.net/weixin_43821918/article/details/105952243

Guess you like

Origin blog.csdn.net/weixin_42565127/article/details/130843575