CSharp examples for System.Collections.Generic:IEnumerable
Cast Valid element from IEnumerable
// Permission is hereby granted, free of charge, to any person using System.Globalization; using System.Linq; using System.Collections; using System.Text; using System.Reflection; using System.Collections.ObjectModel; using System.Collections.Generic; using System;/* ww w . j a v a 2s . com*/ public class Main{ public static IEnumerable<T> CastValid<T>(this IEnumerable enumerable) { ValidationUtils.ArgumentNotNull(enumerable, "enumerable"); return enumerable.Cast<object>().Where(o => o is T).Cast<T>(); } }