Collections & LINQ
Filter, project, and add up decimal values.
- Lists of values
A list is a sequence you can walk from the first item to the last.
Collections · 8 min - Looking up
An index reads one item. It does not change the list.
Collections · 8 min - Walking items
foreach visits every item once, in order.
Collections · 8 min - Filter and sum
Where keeps matching items. Sum adds their values.
LINQ · 8 min - Project a field
Select turns each item into the value you want to add.
LINQ · 8 min - Sort
OrderBy changes the sequence you read. It does not rewrite the array.
LINQ · 8 min - Group
GroupBy gathers rows that share a key.
LINQ · 8 min - Count
Count tells you how many items matched. It does not add their amounts.
LINQ · 8 min - Empty sequences
A filter that keeps nothing has a sum of 0.
LINQ · 8 min - Deferred work
Where describes the filter. Sum is what walks it.
LINQ · 8 min - Several queries
Two Where calls can disagree. Read each one.
LINQ · 8 min - Decimal totals
Money stays in decimal, so 0.10 plus 0.20 is 0.30.
LINQ · 8 min - Paid and unpaid
A bool decides which rows enter the total.
LINQ · 8 min - Refunds
A negative paid amount is still part of the sum.
LINQ · 8 min - Your own project
Open in Code keeps a copy the course cannot overwrite.
LINQ · 8 min - Hash sets for membership checks
Choose a set when the question is whether an item is already present.
Collection techniques · 15 min - Set operations for reconciliation
Find shared, missing, and combined identifiers between two batches.
Collection techniques · 15 min - Queues and first-in, first-out work
Process a small work list in the same order it was accepted.
Collection techniques · 15 min - Stacks and last-in, first-out history
Reverse a sequence of actions with a deliberately limited undo model.
Collection techniques · 15 min - Frequency maps with dictionaries
Count repeated categories without scanning the whole collection for every item.
Collection techniques · 15 min - Deterministic reports from dictionaries
Separate lookup structure from the ordering required by a report.
Collection techniques · 15 min - Equality rules that follow the identifier
Apply one comparer consistently across deduplication, lookup, and grouping.
Collection techniques · 15 min - Removing selected list items safely
Use a predicate-based bulk removal instead of mutating a foreach traversal.
Collection techniques · 15 min - Binary search and insertion positions
Interpret both the found and not-found results of a sorted-list search.
Collection techniques · 15 min - Jagged arrays and per-row contracts
Process rows with different lengths without assuming a rectangular grid.
Collection techniques · 15 min - SelectMany while retaining parent context
Flatten nested values without losing the group each value came from.
Collection techniques · 15 min - Zip and the contract for paired sequences
Combine values by position while checking whether unmatched tails are acceptable.
Collection techniques · 15 min - Joins and one-to-many matches
Predict the number of report rows before joining two keyed collections.
Collection techniques · 15 min - Lookups for repeated group access
Build a one-to-many index when the same grouping will be queried several times.
Collection techniques · 15 min - Aggregate with an explicit seed
Describe a fold whose initial state also defines the empty-input result.
Collection techniques · 15 min - Read-only views and stable snapshots
Distinguish restricted access from independently frozen collection contents.
Collection techniques · 15 min