Overview

A filtering operation restricts the result set to contain only those elements that satisfy a specified condition. The condition is called a predicate.

methods

MethodDescriptionQuery expression
OfTypeSelects values depending on their ability to be cast to the specified typeN/A
WhereSelects values based on a predicate functionwhere

example

string[] words = [ "the", "quick", "brown", "fox", "jumps" ];

In method syntax:

IEnumerable<string> query =
    words.Where(word => word.Length == 3);

In query syntax:

IEnumerable<string> query = from word in words
                            where word.Length == 3
                            select word;