c# array list code example
Example 1: c# array
int[] array = new int[]{1, 2, 3, 4, 5};
foreach (string i in array)
{
Console.WriteLine(i);
}
for(int i=0; i<array.Length; i++){
Console.WriteLine(array[i]);
}
Example 2: csharp create array list
ArrayList a1 = new ArrayList();
a1.Add(1);
Example 3: c# arraylist
ArrayList arrList = new ArrayList()
Example 4: arraylist in C#/
using System.Collections;
ArrayList arlist = new ArrayList();
var arlist = new ArrayList();
Example 5: arraylist in C#
var arlist1 = new ArrayList();
var arlist2 = new ArrayList()
{
1, "Bill", " ", true, 4.5, null
};
int[] arr = { 100, 200, 300, 400 };
Queue myQ = new Queue();
myQ.Enqueue("Hello");
myQ.Enqueue("World!");
arlist1.AddRange(arlist2);
arlist1.AddRange(arr);
arlist1.AddRange(myQ);
Example 6: arraylist in C#
var arlist1 = new ArrayList();
arlist1.Add(1);
arlist1.Add("Bill");
arlist1.Add(" ");
arlist1.Add(true);
arlist1.Add(4.5);
arlist1.Add(null);
var arlist2 = new ArrayList()
{
2, "Steve", " ", true, 4.5, null
};