private void Form1_Load(object sender, EventArgs e)
{
ArrayList arrayList = new ArrayList();
arrayList.Add(“Customer1”);
arrayList.Add(“Customer2”);
arrayList.Add(“Customer3”);
arrayList.Add(“Customer4”);
arrayList.Add(“Customer5”);
The below code demonstrates how to add multiple
items into the ArrayList using AddRange() method.
string[] items = new string[]{ "Customer11","Customer12","Customer13","Customer14"};
arrayList.AddRange(items);
string str = string.Empty;
IEnumerator enumerator = arrayList.GetEnumerator();
while (enumerator.MoveNext())
{
str += enumerator.Current.ToString() + "\n";
}
MessageBox.Show(str);
}
Copyright © 2012 - All Rights Reserved - VKInfotek.com