Lecture overview -- Keyboard shortcut: 'u'  Previous page: LINQ Concepts -- Keyboard shortcut: 'p'  Next page: Basic LINQ Examples -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Page 3 : 11
Object-oriented Programming in C#
An Introduction to LINQ
Map, filter, and reduce

Classical wisdom from functional programming on lists: A large set of problems can be solved by mapping, filtering, and reduction.

  • Mapping

    • Apply a function to each element of a collection and return the resulting collection

    • LINQ: Select

  • Filtering

    • Apply a predicate on each element of a collection, and return those elements that satisfy the predicate

    • LINQ: Where

  • Reduction

    • Apply a binary function on neighbour pairs of collection elements (either from left to right, or right to left), and "boil" down the collection to a single value.

    • LINQ: Aggregate

      • Specialized aggregations: Count, Min, Max, Sum, Average.