C implements AddRange's method of adding multiple elements to an array

  • 2021-07-01 08:08:12
  • OfStack

This article illustrates how C # implements AddRange to add multiple elements to an array. Share it for your reference. The specific implementation method is as follows:


ArrayList ab = new ArrayList();
ab.Add("a"); //old fashioned way
ab.Add("b");
ArrayList abcd = new ArrayList();
abcd.AddRange(new string[] {"a","b","c","d"});
// new hip method

I hope this article is helpful to everyone's C # programming.


Related articles: