/DoubleSharp

A set of extension methods and helpers for .NET (C# specifically)

Primary LanguageC#MIT LicenseMIT

Overview

DoubleSharp provides convenience features for:

  • LINQ: ToDictionary converting IEnumerables of tuples into Dictionarys automatically; Shuffle and Shuffled providing in-place and copy shuffles; Flatten reducing the nesting of IEnumerables; and much more
  • Concurrency: Locked extension method on objects allowing locking as an expression; Increment/Decrement/Add providing inline atomic operations
  • Functional: Compose allowing function composition
  • Progress: WithProgress and WithTimedProgress extension methods on IEnumerable/ICollection providing parallel-friendly progress bars
  • Random: Rng providing a static class with automatic per-CPU seeds
  • Pretty: ToPrettyString extension method for all objects to convert it to a human-readable form; Print and PrettyPrint extension methods (aliases) to print that to the console, akin to Python's pprint module

Our general goal is to make C# even easier to use than it is right now. If it's something we have to write in several projects, it should be here instead.

Usage

Simply reference the DoubleSharp package on NuGet and then import the namespaces with the functionality you need.

Check out the progress bar example or the unit tests for use cases!