Adding an Array to an Array List

  • Thread starter Thread starter Jack Addington
  • Start date Start date
J

Jack Addington

Is it possible to add an array to an ArrayList with one call? Instead of
iterating through each of the array's members and doing an ArrayList.Add( )
?

thanks
 
ArrayList.AddRange()

Is it possible to add an array to an ArrayList with one call? Instead of
iterating through each of the array's members and doing an ArrayList.Add( )
?

thanks
 
System.Collections.ArrayList a = new ArrayList();

string[] s = {"a","b","c"};

a.AddRange(s);

foreach (object o in a.ToArray())

{

System.Diagnostics.Debug.WriteLine(o.ToString());

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top