C# Arrays
In the real world, programming usually involves groups of objects. Arrays are specifically designed to store groups of objects, with the object being retrieved using an index value. You should know that collections—and the structures based on collections in C#, such as queues, ArrayLists, and much more—are an alternative mechanism for grouping and coping with multiple objects.
If you don’t know how to deal with multiple items in arrays (and other classes designed for use with multiples, such as those based on the System.Collection classes), then your programs will never scale—or be of much use when dealing in an automated fashion with the large amount of data presented by the real world.
In C#, an array is an object used to store objects of the same type and provides access to the objects using an index. You should know that—just as the string keyword is used to create an object of type System.String—the syntax and expressions used to create arrays actually create an object based on the System.Array class. This means that you can use the members—methods and properties—provided by the Array class when you work with arrays.
Arrays in C# are, for the most part zero-indexed—meaning that the array indices start at 0.
Single-dimensional arrays can be thought of as a table with one column that can be accessed using an index. Multidimensional arrays use multiple indices to access their values, so a two-dimensional array can be pictured as table with rows and columns. In a jagged array—also called an array of arrays—each “row” in the array is itself an array, with a potentially different size than the arrays making up the other rows.
|
|
Search Engine Optimization
 
Syndication Viewer
Our Web host:
IX WebHosting
|