Convert ICollection<T> to List<T>
The easiest way to convert a ICollection
to a List
is the usage of LINQ like (MSDN)
List<T> L = C.ToList();
Dont't forget to add
using System.Linq;
otherwise ToList()
is not available.
You can supply the collection as an argument in the List<T>
constructor:
List<DataStructure> lst_DataStructure = new List<DataStructure>(list_Stuctures);
Or use the .ToList()
extension method, which does exactly the same thing.
Keep it simple, ToList:
List<DataStructure> lst_DataStructure = list_Stuctures.ToList();