Where (filter)

Download .net eBook

Example

This method returns an IEnumerable with all the elements that meets the lambda expression

Example

var personNames = new[] 
{
    "Foo", "Bar", "Fizz", "Buzz"
};

var namesStartingWithF = personNames.Where(p => p.StartsWith("F"));
Console.WriteLine(string.Join(",", namesStartingWithF));

Output:

Foo,Fizz

View Demo

Stats

Contributors: 6
2016-10-15
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook