Enumerable.Where : Enumerable « System.Linq « C# / C Sharp by API






Enumerable.Where

  

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
    public static void Main() {
        string[] strings = { "one", "two", null, "three" };

        Console.WriteLine("Before Where() is called.");
        IEnumerable<string> ieStrings = strings.Where(s => s.Length == 3);
        Console.WriteLine("After Where() is called.");

        foreach (string s in ieStrings) {
            Console.WriteLine("Processing " + s);
        }

    }
}

   
    
  








Related examples in the same category

1.Enumerable.Aggregate
2.Enumerable.Average()
3.Enumerable.Cast
4.Enumerable.Count()
5.Enumerable.DefaultIfEmpty
6.Enumerable.Distinct()
7.Enumerable.ElementAt
8.Enumerable.ElementAtOrDefault
9.Enumerable.ElementsAfterSelf
10.Enumerable.Empty
11.Enumerable.First
12.Enumerable.OrderBy
13.Enumerable.Range
14.Enumerable.Repeat