CSharp examples for System.Collections.Generic:IEnumerable
Copy IEnumerable to List
using System.Collections; using System.Text; using System.Linq; using System.Collections.Generic; using System;/* w w w . j a v a 2 s . co m*/ public class Main{ public static List<T> Copy<T>(this IEnumerable source) where T : class,new() { List<T> lstT = new List<T>(); IEnumerator enumerator = source.GetEnumerator(); while (enumerator.MoveNext()) { lstT.Add(enumerator.Current.Copy<T>()); } return lstT; } }