1. arrays are reference types, while arrays of value types are also reference types.
2. Int [] Myint; Myint = new int [100];
First, Myint is mysteriously regarded as a one-dimensional array variable pointing to the element type Int. At this time, Myint is set to null.
. When an array of 100 int values is allocated, all these int element values are initialized to 0. Although Int Is of the Value Type
Memory blocks that save the int values are allocated from the managed heap. The memory contains 100 boxed int
Value, lastCodeReturn the memory block address that saves the int value and save it in the variable Myint.
Control [] myctr; myctr = new control [50];
First, myctr is set to null, and then an array containing 50 control references is allocated.
Control references are initialized to null, because control belongs to the reference type, all
It is a reference, not an actual object. The final code returns the memory address that saves the reference and saves it in
Variable in myctr.
3. Try to use a 0-base array, which has the best performance and is compatible with Cls (the staggered array is not compatible.
CLs); if the index exceeds the limit, the system. indexoutofrangeexception is thrown.
4. All arrays are inherited from system. array, which implements icloneable, ienumerable,
Icollection and ilist interfaces; CLR does not allow the conversion of arrays whose elements are value types to any other types,
It is through, array. Copy (bind the value type to the reference type; bind the reference type to the value type, broaden
CLR primitive type), and it is a shortest copy. Array of referenced elements, which can be displayed
Or implicitly converted to another type.
5. arrays are always passed to the method in reference mode. array. copy is a shortest copy. If the elements in the source array
Element is the reference type. The elements in the new array returned by this method are the objects referenced by the elements in the source array.
The deep COPY method of the current array is to implement the icloneable interface to serialize an object to
System. Io. memorystream, and then immediately deserialize the memory stream to obtain a new
Object, performance loss, and possibly all objects are serialized.
6. You can create an array whose lower limit is not 0 and use the array. createinstance method.