Kurt Nørmark ©
Department of Computer Science, Aalborg University, Denmark
Abstract Previous lecture Next lecture Index References Contents | In this lecture we will introduce LINQ. We will emphasize the historical background of LINQ, and the basic C# ideas and patterns, on top of which LINQ has been built. We will also draw the attention to similarities and differences between LINQ queries and methods in the generic List class, which we discussed in an ealier lecture about collections. |
Origin and Rationale Slide Annotated slide Contents Index References |
|
|
|
LINQ Concepts Slide Annotated slide Contents Index References |
|
Map, filter, and reduce Slide Annotated slide Contents Index References |
|
|
Basic LINQ Examples Slide Annotated slide Contents Index References |
|
Program: Sample Data - short form. |
|
Program: Sample data - Class Persons and a collection of persons. |
|
Program: The average age of all females. |
|
Program: The average age of all females - basic version. |
|
Program: A comma-separated list of all male first names, youngest first. |
|
Program: A sequence of female-male pairs sequences. |
|
Program: Same - using flattening SelecteMany. |
|
Program: Equivalent output of last two programs: all femal-male pairs. |
|
An overview of some LINQ Query Operators Slide Annotated slide Contents Index References |
|
|
LINQ Query Operations vs List<T> methods. Slide Annotated slide Contents Index References |
|
|
Exercise 16.2. List og Linq? | Get some practical experience with the List and LINQ operations described on the accompanying slide. You may, for instance, activate the operations on a simple collection of numbers. Be sure to understand the difference between an imperative solution (the state of the collection is affected, the collection is mutable) and a functional solution (the collection is not modified, immutable). |
How a LINQ Query Operation works Slide Annotated slide Contents Index References |
|
Program: Reproduction of some central query operations. |
|
Program: Using the reproduced query operations. |
|
|
Deferred Execution Slide Annotated slide Contents Index References |
|
|
Compression and buffering decoration of a FileStream |
The technical basis of LINQ Slide Annotated slide Contents Index References |
|
|
|
Query Syntax versus Method Syntax Slide Annotated slide Contents Index References |
|
Program: The average age of all females - revisited. |
|
Program: Same program with use of query syntax. |
|
Program: A comma-separated list of all male first names, youngest first - revisited. |
|
Program: Same program with use of query syntax. |
|
A Final Example: Sieve of Eratosthenes. Slide Annotated slide Contents Index References |
|
Program: The Sieve query operator. |
|
Program: An application of the Sieve query operator. |
|
Program: The AdInfinitum extension method in type long. |
|
Program: The program output - the first 100 primes. |
|
Collected references Contents Index |
|
Chapter 16: An Introduction to LINQ
Course home Author home About producing this web Previous lecture (top) Next lecture (top) Previous lecture (bund) Next lecture (bund)
Generated: February 7, 2011, 12:24:18