LinqExtensions.

Filter<TSource>(IEnumerable<TSource>, Func<TSource, bool>) Method

Summary

Filters a sequence of values based on a predicate.

Syntax

public static IEnumerable<TSource> Filter<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)

Type Parameters

Name Description
TSource The type of the elements of source.

Parameters

Name Type Description
source IEnumerable<TSource> An System.Collections.Generic.IEnumerable`1 to filter.
predicate Func<TSource, bool> A function to test each element for a condition.

Return Value

Type Description
IEnumerable<TSource> An System.Collections.Generic.IEnumerable`1 that contains elements from the input sequence that satisfy the condition.