If you are in a situation where you need to add an item to an array you will need to use one of the collection classes such as the Arraylist. New values cannot be added to an array that has set values.
String Array Example
string[] list = new string[] { "one", "two", "three" };
foreach (string item in list)
{
Response.Write(item);
}
Arraylist Example
Arraylist list = new Arraylist();
list.Add("one");
list.Add("two");
list.Add("three");
foreach (string item in list)
{
Response.Write(item);
}
Related Posts
Tags: add dynamically, array, c#





















