C# - Convert a Type Array to a Generic List
c#
Solution
try this:
ShippingPeriod [] arrShippingPeriods;
//init and populate array
IList<ShippingPeriods> lstShippingPeriods =
arrShippingPeriods.ToList<ShippingPeriods>();
You need to call ToList on the array object not the class of objects contained in array.
Problem
Code Snippet: ``` ShippingPeriod[] arrShippingPeriods; . . . List<ShippingPeriod> shippingPeriods = ShippingPeriodList.ToList<ShippingPeriod>(); ``` The Last line won't compile and the error I get is: "'ShippingPeriod[]' does not contain a definition for 'ToList' and the best extension method overload 'System.Linq.Enumerable.ToList(System.Collections.Generic.IEnumerable)' has some invalid arguments"