typestar

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.

Start this tour

Regular expressions

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

More collections

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.

The other C# tours