Converting from IEnumerable to List

c#, ienumerable, list

Solution

You can do this very simply using LINQ.

Make sure this using is at the top of your C# file:

using System.Linq;

Then use the `ToList` extension method.

Example:

IEnumerable<int> enumerable = Enumerable.Range(1, 300);
List<int> asList = enumerable.ToList();

Problem

I want to convert from `IEnumerable<Contact>` to `List<Contact>`. How can I do this?

Original source

Related problems