internal static IEnumerable <T> Where <T>(this IEnumerable <T> enumerable, Microsoft.Scripting.Utils.Func <T, bool> where) { foreach (T t in enumerable) { if (where (t)) { yield return(t); } } }
internal static bool Any <T>(this IEnumerable <T> source, Microsoft.Scripting.Utils.Func <T, bool> predicate) { foreach (T element in source) { if (predicate(element)) { return(true); } } return(false); }
// Need to reproduce these helpers from DLR codeplex-only sources and // from LINQ functionality to avoid referencing System.Core.dll and // Microsoft.Scripting.Core.dll for internal building. internal static IEnumerable <U> Select <T, U>(this IEnumerable <T> enumerable, Microsoft.Scripting.Utils.Func <T, U> select) { foreach (T t in enumerable) { yield return(select(t)); } }
// From Microsoft.Scripting.Utils.CollectionExtensions // Name needs to be different so it doesn't conflict with Enumerable.Select #if CLR2 internal static U[] Map <T, U>(this ICollection <T> collection, Microsoft.Scripting.Utils.Func <T, U> select)