Methods, delegates and LINQ
This part of the C# course builds the code above a single method. Methods and their arguments come first — ref, out, in, params and optional parameters — then local functions, delegates, lambdas and events. LINQ takes the rest of the part: the same query in query syntax and in method syntax, deferred execution, filtering and projection, grouping and joining, the aggregates, and SelectMany with null.
3.1
Methods
declaration, parameters, overloading, static
Open
3.2
ref, out and in
what each one promises, TryParse, a struct passed by reference
Open
3.3
params, optional and named arguments
the three, the order they must keep
Open
3.4
Local functions
a function inside a method, static local functions, a closure
Open
3.5
Lambdas and delegates
delegate, a lambda, Func and Action, a captured variable
Open
3.6
Events
event, EventHandler, subscribe and unsubscribe, the leak of a missing -=
Open
3.7
LINQ: query syntax
from, where, select, orderby, group by, let
Open
3.8
LINQ: method syntax
Where, Select, OrderBy, ThenBy, the same query twice
Open
3.9
Deferred execution
the query is not the data, when it runs, ToList
Open
3.10
Filtering and projection
Where, Select with an index, an anonymous type, Distinct
Open
3.11
Grouping and joining
GroupBy, Join, GroupJoin, ToLookup, a grouped report
Open
3.12
Aggregates
Sum, Min, Max, Average, Count, Any, All, Aggregate
Open
3.13
SelectMany and null in a query
flattening, FirstOrDefault, ??, a nullable chain
Open