DoubleSharp provides convenience features for:
- LINQ:
ToDictionary
convertingIEnumerable
s of tuples intoDictionary
s automatically;Shuffle
andShuffled
providing in-place and copy shuffles;Flatten
reducing the nesting ofIEnumerable
s; and much more - Concurrency:
Locked
extension method on objects allowing locking as an expression;Increment
/Decrement
/Add
/And
/Or
providing inline atomic operations - Functional:
Compose
allowing function composition - Progress:
WithProgress
andWithTimedProgress
extension methods onIEnumerable
/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
andPrettyPrint
extension methods (aliases) to print that to the console, akin to Python'spprint
module - Buffers:
Cast
andAsEnumerable
extensions forMemory<T>
andSpan<T>
,HexDump
(for Console/TextWriter output) andToHexDump
(for string creation) for all common unmanaged buffers - MathPlus: Root finding, Vector2D type for double precision, swizzles for
Vector2/2D/3/4
, linear interpolation, tuple<->Vector conversions, Vector deconstruction,Centroid
extension method forIEnumerable<Vector2/2D/3/4>
,Map
for Vector to perform elementwise transformation, bit operations for unsigned integer types,Ceil
/Floor
/Round
extensions for float/double, andCeilInt
/FloorInt
/RoundInt
extensions for floor/double to int - IO: Vector extensions for BinaryReader/BinaryWriter.
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.
API docs are available at https://doublesharp.dev/
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!