S
shapper
Hello,
Could someone tell me how to create an array of strings?
Thanks,
Miguel
Could someone tell me how to create an array of strings?
Thanks,
Miguel
Mark Fitzpatrick said:To create an array of a particular size, try the following
string[] myArray = new string[5];
this wuold create an array of 5 strings in C#. There are also array and
collection classes in the System.Collections namespace that can be of
help, such as the NameValueCollection when you need an array of name/value
pairs.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
shapper said:Hello,
Could someone tell me how to create an array of strings?
Thanks,
Miguel
If you don't know the size of the array needed up front, use a collection.
In 2.0, you can use a generic:
List<string> myArray = new List<string>();
and then you can do
myArray.Add("1");
in 1.x, use an ArrayList:
ArrayList arr = new ArrayList();
arr.Add("1");
Karl