Append a Lists Contents to another List C#

c#

Solution

GlobalStrings.AddRange(localStrings);

Note: You cannot declare the list object using the interface (IList). Documentation: `List<T>.AddRange(IEnumerable<T>)`.

Problem

I have the following: - A main List called GlobalStrings - Another List called localStrings In a loop for example: ``` List<string> GlobalStrings = new List<string>(); List<string> localStrings = new List<string>(); for(x=1;x<10;x++) { localStrings.Add("some value"); localStrings.Add("some value"); } // Want to append localStrings to GlobalStrings as easily as possible ```

Original source