Add the elements from another collection to the end of the List in CSharp
Description
The following code shows how to add the elements from another collection to the end of the List.
Example
using System;/*from w w w . j a v a 2s. c o m*/
using System.Collections;
using System.Collections.Generic;
class Sample
{
public static void Main()
{
List<string> words = new List<string>();
words.AddRange(new[] { "C", "D" });
foreach (string s in words) {
Console.WriteLine (s);
}
}
}
The code above generates the following result.