Append Lists

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,

I would like to know how can I append 2 List<T> in c# ?

Thank you!
 
I would like to know how can I append 2 List<T> in c# ?

List<T>.AddRange will add the contents of one list (or any
IEnumerable<T>) to another
or use LINQ and the Concat operator to leave both lists unchanged.

IEnumerable<string> both = firstList.Concat(secondList);
// Call ToList if you want another list

Jon
 

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