Case study
Humanizexternity
C# library that turns raw measurements into human-readable strings
One-line extension method turns 1.2e7ms into "about 3.3 hours".
- C#
- .NET Standard 2.0
- xUnit
Problem & context
Logs and APIs are full of 1.2e7ms, 1048576 KB, 0.000003s. Reading them slows down debugging. Existing humanizers were either abandoned or too opinionated.
Constraints & tradeoffs
- Zero dependencies — pure BCL only.
- Must work on .NET Standard 2.0 for maximum reach.
- Extension methods only, no configuration boilerplate.
Solution
A fluent extension API: 1500.Milliseconds().ToHumanReadable() returns "about 1.5 seconds". Formatters are pluggable, culture-aware, and allocate near-zero on the hot path.
Architecture
- 01Extension methods on numeric types
- 02Fluent unit wrappers (Milliseconds, Bytes, …)
- 03Pluggable formatter interface
- 04Culture-aware rendering
Results
- Target framework
- netstandard2.0
- Dependencies
- 0
- Published
- NuGet
- API style
- Fluent
Lessons learned
- Extension methods make the library feel native to C#.
- Zero deps is a feature — it removed the biggest NuGet install objection.
- Culture-aware formatting is harder than it looks; ship it early.