You cannot directly add to the array but if you declare a new array with more
open locations and clone the original you can then place new values into that
array as in the following:
string[] strs = {"a", "b", "c"};
string[] arrCollection = (string[])strs.Clone();
strs = new string[arrCollection.Length + 1];
arrCollection.CopyTo(strs,0);
strs[strs.Length - 1] = "new value";
if you look at the IEnumerable interface you might be able to create a
string collection object that you can place that kind of code into a method
of the collection. Information on that is located on the MSDN website at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkForeachTutorial.asp
With a collection class, you can reuse the code for your method to add a new
member to an array.
George Prado
Raymond Du said:
Hi,
Is it possible to redim a String[]? Say I have the following code:
String[] strs = {"a", "b", "c"};
How do I add more String into strs?
Thanks in Advance