CSharp examples for System.Collections:IEnumerable
Cast List from IEnumerable
using System.Windows; using System.Collections.Generic; using System.Collections; public class Main{ internal static IEnumerable<TDst> CastList<TSrc, TDst>(IEnumerable<TSrc> src) {//from w w w . java 2s . c o m var dst = new List<TDst>(); foreach (var e in src) { dst.Add((TDst)(object)e); } return dst; } internal static void CastList(IEnumerable<DependencyObject> src, IList dst) { foreach (var e in src) { dst.Add(e); } } }