TK. TK. - 1 year ago 65
C# Question

Freely convert between List<T> and IEnumerable<T>

How can I convert a

to an
and then back again?

I want to do this in order to run a series of LINQ statements on the List, e. g.

Answer Source
List<string> myList = new List<string>();
IEnumerable<string> myEnumerable = myList;
List<string> listAgain = myEnumerable.ToList();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download