FindAll

In this chapter you will learn:

  1. How to use FindAll operator

Get to know FindAll operator

using System;/*from j  a  va2 s  . c  om*/
class Film
{
    public string Name { get; set; }
    public int Year { get; set; }
    public override string ToString()
    {
        return string.Format("Name={0}, Year={1}", Name, Year);
    }
}

class MainClass
{
    static void Main()
    {
        var films = new List<Film>
        {
            new Film {Name="J", Year=1975},
            new Film {Name="H", Year=2000},
            new Film {Name="T", Year=1995}
        };

        Action<Film> print = film => Console.WriteLine(film);
        Console.WriteLine("Oldies");
        films.FindAll(film => film.Year < 1980).ForEach(print);
        Console.WriteLine();

    }        
}

Next chapter...

What you will learn in the next chapter:

  1. How to use First operator
  2. Use First with expression
  3. First with string method
  4. Retrieving all strings in an array whose length matches that of the shortest string
Home » C# Tutorial » Linq Operators
Aggregate
Aggregate with seed
Aggregate string value
All
Any
Average
Cast
Concat
Contains
Count
DefaultIfEmpty
Distinct
ElementAt
ElementAtOrDefault
Empty
Except
FindAll
First
FirstOrDefault
GroupBy
Intersect
Last
LastOrDefault
LongCount
Max
Min
OfType
OrderBy
OrderByDescending
Range
Repeat
Reverse
SelectMany
SequenceEqual
Single
SingleOrDefault
Skip
SkipWhile
Sum
Take
TakeWhile
ThenBy
ThenByDescending
ToArray
ToList
Zip