Esempio n. 1
0
 /// <summary>
 /// Creates a new query that filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
 /// </summary>
 /// <typeparam name="TSource">The type of the elements of query.</typeparam>
 /// <param name="query">An query whose values to filter.</param>
 /// <param name="predicate">A function to test each source element for a condition; the second parameter of the function represents the index of the source element.</param>
 /// <returns>A query that contains elements from the input query that satisfy the condition.</returns>
 public static IQueryExpr <IEnumerable <TSource> > Where <TSource>(this IQueryExpr <IEnumerable <TSource> > query, Expression <Func <TSource, int, bool> > predicate)
 {
     return(new QueryExpr <IEnumerable <TSource> >(QExpr.NewFilterIndexed(predicate, query.Expr)));
 }