Arrays in ASP.NET

Arrays allows you to store a series of value that have the same data type. Each individual value in the array is accessed using one or more index number. It's often convenient to picture arrays as list of data (if the array has more then one dimension) or grids of data (if the array has two dimension). Typically, arrays are laid out contiguously in memory.
All arrays start start at a fixed lower bound. This rule has no exception. When you create an array in C#, you specify the numbers of elements.Because counting start at 0, the highest index is actually one fewer than the number of elements.

//Create an array with four string (from index 0 to index 3).

//You need to initialize the array with the new keyword in order to use it:
string[] vStringArray1=new string[4];

//Create a 2*4 grid array (with a total of 8 integers).
int[,] vIntArray1=new int[2,4];

No comments:

Post a Comment