[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CSharpArray
An alternative to using a plain array is to use the ArrayList class, which can change size at run-time.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CSharpArray
(C#) array
A way to store a a large number of values and access them by index.Example
//Setting the size of the array
const int size = 10;
//Declare the array
int[] myArray = new int[size];
//Initializing array
for(int i=0; i<size; ++i) myArray[i] = i;
//Showing array on screen way #1
for(int i=0; i<size; ++i)
Console.WriteLine("Array[" + i.ToString() + "]: " + myArray[i].ToString());
//Showing array on screen way #2
foreach (int i in myArray)
Console.WriteLine("Array[" + i.ToString() + "]: " + myArray[i].ToString());
An alternative to using a plain array is to use the ArrayList class, which can change size at run-time.
Array links
Code links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
