public static List <TSource> ToList <TSource>(this IEnumerable <TSource> source) { if (source == null) { throw Error.ArgumentNull("source"); } IIListProvider <TSource> listProvider = source as IIListProvider <TSource>; return(listProvider != null?listProvider.ToList() : new List <TSource>(source)); }
public List <IGrouping <TKey, TElement> > ToList() { IIListProvider <IGrouping <TKey, TElement> > lookup = Lookup <TKey, TElement> .Create(_source, _keySelector, _elementSelector, _comparer); return(lookup.ToList()); }