LINQ in Practice
Understand execution, ordering, grouping, joins, and reliable aggregation.
- Deferred queries
Observe when a query actually reads its source.
Core ideas · 10 min - Materializing a snapshot
Choose the moment a result becomes stored data.
Core ideas · 10 min - Projecting records
Transform each item into the shape the next step needs.
Core ideas · 10 min - Any and All
Ask an existence question without constructing a filtered list.
Core ideas · 10 min - Ordering and tie breakers
Make repeated report output deterministic.
Working with data · 10 min - Grouping and summaries
Calculate one total for each category.
Working with data · 10 min - Dictionary boundaries
Decide how duplicate keys should behave.
Working with data · 10 min - Flattening nested data
Turn several child sequences into one stream.
Working with data · 10 min - Joining related rows
Match records by a key rather than by position.
Putting it together · 10 min - Paging a stable sequence
Apply a page size after deciding the ordering.
Putting it together · 10 min - Decimal aggregation
Keep a money calculation numeric and explicit.
Putting it together · 10 min - Reusable query boundaries
Return a stable report from a pure calculation.
Putting it together · 10 min - DistinctBy and explicit identity keys
Remove repeated entities using a key rather than whole-object equality.
Deeper practice · 18 min - IntersectBy and ExceptBy as membership policies
Select entities by whether their keys appear in another collection.
Deeper practice · 18 min - Chunking with a final partial batch
Partition work while preserving every remaining element.
Deeper practice · 18 min - Zip aligns positions and stops at the shorter input
Combine related positions while checking that their lengths satisfy the contract.
Deeper practice · 18 min - Aggregate carries an explicit accumulator
Build a summary whose state and empty-input behavior are visible.
Deeper practice · 18 min - DefaultIfEmpty expresses an empty-sequence policy
Choose an explicit fallback without confusing missing observations with real data.
Deeper practice · 18 min - First and Single assert different cardinalities
Make the expected number of matching records part of the query.
Deeper practice · 18 min - Lookup indexes one-to-many relationships
Build an index when each key can intentionally have several values.
Deeper practice · 18 min - Left joins preserve unmatched parent rows
Represent missing related data explicitly instead of dropping the parent.
Applied techniques · 18 min - Cartesian products and multiplicative growth
Recognize when flattening creates every combination rather than matching keys.
Applied techniques · 18 min - TakeWhile and Where ask different sequence questions
Separate an initial valid prefix from matching elements anywhere.
Applied techniques · 18 min - Indexed query operators and original positions
Keep source positions before a filtering step changes the sequence.
Applied techniques · 18 min - SequenceEqual checks both order and equality
Compare ordered results with the comparer your domain requires.
Applied techniques · 18 min - Concat and Union preserve different information
Choose between concatenating rows and constructing a set of values.
Applied techniques · 18 min - Query expressions with let bindings
Name intermediate calculations once inside a readable query.
Applied techniques · 18 min - Ranking within independent groups
Reset a positional rank for each partition and make tie ordering deterministic.
Applied techniques · 18 min