by Jonathan Bright | Nov 6, 2026 | Tutorials
A locked hatch is both an exit and something you can use. A chest holds objects but does not lead anywhere. Modeling those abilities separately lets the command loop ask what an object can do without maintaining a different branch for every concrete class. Build a...
by Jonathan Bright | Nov 6, 2026 | Tutorials
Adding WithCancellation to an await foreach loop can still leave an async stream producing items after cancellation. The consumer supplies a token, but the iterator must receive it and use it where work waits. This tutorial reproduces that gap with a finite stream,...
by Jonathan Bright | Nov 5, 2026 | Tutorials
A rule table is easier to trust when every cell is checked. This console tutorial scores Rock, Paper, Scissors, Lizard, Spock with one switch expression over the pair of moves, then checks all 25 possible rounds. The result is always from the player’s...
by Jonathan Bright | Nov 5, 2026 | Tutorials
A compression round trip has one decisive check: do the decompressed bytes equal the original bytes? This console program uses BrotliStream to answer that question for repeated text, seeded random bytes and an empty array. It also prints a size table for three...
by Jonathan Bright | Nov 5, 2026 | Tutorials
Keep a lock’s identity under your control. A string, a publicly accessible object, or a Type can let unrelated code acquire the same gate and delay your operation. A dedicated private gate prevents callers from obtaining that gate through your public API. This...