16th Chapter Array

Source: Internet
Author: User

An array is a mechanism that allows multiple data items to be treated as a collection. The CLR supports one-dimensional arrays, multidimensional arrays, and jagged arrays (that is, arrays of arrays). All array types are implicitly derived from the System.Array abstract class, meaning that the arrays are always reference types and are memory-allocated on the managed heap. In your application's variables or fields, it contains references to arrays, not elements that contain the array itself.

Int32[] myintegers;//declares an array reference

Myintegers = new int32[100];//creates an array with 100 Int32

In the first line of code, the Myintegers variable can point to a one-dimensional array. Myintegers was initially set to NULL because there was no array allocated at that time. In the second line of code, an array with 100 Int32 values is allocated, and all Int32 are initialized to 0. Because the array is a reference type, the block of memory required to hold 100 unboxed Int32 is allocated on the managed heap. In addition to array elements, the memory block occupied by an array object also contains a type object pointer, a synchronous block index, and some additional members. The memory block address of the array is returned and saved to the myintegers variable.

16th Chapter Array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.