CSharp examples for System.Collections.Generic:IEnumerable
Cast IEnumerable To List
using System.Linq; using System.Collections.Generic; public class Main{ public static List<T> CastOrToList<T>(this IEnumerable<T> source) {/*from w w w . j a v a2 s. c o m*/ return source as List<T> ?? source.ToList(); } }