Re: Inserting into an Array but not ArrayList
Create a new array with the appropriate size and add the items from the old array into it.
Code:
string[] existingarray = { "one", "two", "three" };
foreach (string s in existingarray)
Console.Write(s + " ");
Console.WriteLine();
string newvalue = "four";
string[] newarray = new string[4];
newarray[0] = existingarray[0];
newarray[1] = existingarray[1];
newarray[2] = existingarray[2];
newarray[3] = newvalue;
foreach (string s in newarray)
Console.Write(s + " ");
Console.WriteLine();
It's not a bug, it's a feature!