Lecture overview -- Keyboard shortcut: 'u'  Previous page: Basic LINQ Examples -- Keyboard shortcut: 'p'  Next page: LINQ Query Operations vs List<T> methods. -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Page 5 : 11
Object-oriented Programming in C#
An Introduction to LINQ
An overview of some LINQ Query Operators

  • Operators that return sequences s

    • s.Select(Func)         Func is an arbitrary element function

    • s.Where(Func)         Func is a predicate element

    • s.Distinct()         Removes duplicates

    • s.Take(int)

    • s.Intersect(Sequence)

    • s.Union(Sequence)

    • s.Concat(Sequence)

    • s.OrderBy(Func)         Func is key selector

  • Operators that return an element

    • s.Aggregate(Func) ,     s.Aggregate(seed, Func)

    • S.First()

    • S.Last()

    • S.Max()

    • S.Min()

    • S.ElementAt(int)

    • s.Single()       Returns the only element.

  • Predicates (return boolean)

    • s.Any()       Returns if there is at least one element

    • s.Contains(element)

  • Operators that return an other type of object

    • S.Count()

See the extension methods in the generic interface System.Collections.Generic.IEnumerable<T> and, even better, in the static class System.Linq.Enumerable