The .NET library
17 steps in 6 sets of C#.
The .NET base class library is the accumulated toolbox of twenty-five years: a regex engine that has parsed a measurable fraction of the world's logs, a JSON stack rebuilt from scratch for speed in 2019, and date types that finally admit a calendar date is not a midnight timestamp. Knowing what is already in the box is most of what separates fluent C# from C# with reinvented wheels.
This tour works through the pieces you reach for weekly: regular expressions with named groups, System.Text.Json in its three modes, DateOnly and TimeSpan arithmetic, the specialized collections behind queues and leaderboards, and the diagnostics trio of Stopwatch, Environment and Random.Shared. The encore ships a log analyzer and a JSON-backed task list, both built from nothing but this tour.
Regular expressions
- Match & groupsNamed groups turn a log line into fields.
- Replace & SplitRegexes as text surgery: split on patterns, replace by function.
- Matches & LINQEvery occurrence, straight into a LINQ pipeline.
JSON
- SerializingObject to JSON in one call with System.Text.Json.
- DeserializingJSON to a typed record, case-insensitively.
- JsonNodeJSON you explore rather than map onto a type.
Dates & times
- DateOnly & TimeOnlyCalendar dates and wall-clock times, without the fake midnight.
- TimeSpanDurations that add, compare and scale like numbers.
- Parsing & offsetsExact parsing, and offsets that pin a moment to the globe.
More collections
- Queue & StackFIFO and LIFO, named for what they do.
- PriorityQueueThe heap that serves the most urgent item first.
- Sorted collectionsCollections that keep themselves in order.
Diagnostics & environment
- StopwatchMeasure elapsed time with the clock made for it.
- EnvironmentWhat the process knows about where it is running.
- Random.SharedThe ready-made generator, no seeding ceremony.
Encore
- log_analyzer.csRegex, LINQ and a little math turn a raw log into answers.
- todo_json.csA task list that survives restarts: JSON in, JSON out.