DNX.Helpers

.NET Extensions and helpers for Core and Common .NET types


Keywords
DNX, helpers, extensions, string, array, linq
License
MIT
Install
Install-Package DNX.Helpers -Version 2.1.0

Documentation

DNX.Helpers

Built by Travis CI Build Status

DNX Solutions Logo DNX.Helpers is a .NET package that contains the bits that I've found lacking or missing from the .NET standard library. It has minimal dependencies on other packages and so is designed to be included to your projects with little or no disruption.

It is designed around the premise that code should be as readable as possible at the highest level possible.

E.g. Replaces code that would normally look something like:

var escapedCode = string.Format("{0}{1}{2}",
    code != null && code.StartsWith("[") ? null : "[",
    code,
    code != null && code.EndsWith("]") ? null : "]"
    );

with

var escapedCode = code.EnsureStartsAndEndsWith("[", "]");

Installation

From NuGet package explorer:

Install-Package DNX.Helpers

Contents

Helpers are divided into the following namespaces:

Namespace Descripion
Assemblies Classes for interrogating Assemblies in a easier way
Comparisons Make working with or implementing an IComparer much simpler
Converters Simplify converting textual data to the built in types
Dates Simplify working with Dates, especially when UTC or not is a consideration
Enumerations The enum parsing and manipulation functionality that .NET forgot
Exceptions The custom exceptions that can get thrown by these functions
Interfaces Common useful interfaces that promote conformity
Linq Some useful extension methods and classes for working with enumerables
Maths Some useful extension methods for math comparisons across the built in types
Objects Some extension methods that apply to any object
Reflection Makes querying your own code at runtime so much simpler
Streams Some useful helpers for working with streams without having to remember how to setup readers, etc
Strings Extensions to the string class to simplify working with textual data
Threading Helper methods for working with asynchronous code. Includes a Mutex manager and a Pub/Sub queue
Validation Guard classes and methods to simplify argument validation

Also, check out the Unit Test project for some usage examples.

Reference

Full Namespace reference

To Do

To Do

Contributing

Contributions welcome. All code must be comprehensively covered by unit tests using NUnit 3

Credits

By Martin Smith, 2001 onwards

Licence

Licence

Related Projects

Project Location
DNX.Helpers General purpose .NET standard library helpers
DNX.Helpers.Console For working with console applications
DNX.Helpers.CommandLine For working with Command Line parsing
DNX.Helpers.Log4Net For working with Log4Net

Acknowledgements

With grateful thanks to all the people and organisations below, who've contributed something to either make the development of this easier, or generally contributed to making Visual Studio an awesome environment:

Title Description
Resharper Ultimate The guys at JetBrains make awesome tools for whatever your development language of preference. Visual Studio would not be complete without Resharper Ultimate
Travis CI A cloud Continuous Integration environment that's easy to integrate with and is still as feature rich as you could need. Your builds have caught my lack of cross-platform awareness more than once
GhostDoc Pro Good intellisense is key to almost any library and GhostDoc generates sensible documentation at the touch of a button. A community edition is also available for free
BuildVision For multi-project solutions, this is the best build visualizer. Can't wait for a VS 2019 version
VSColorOutput Bring colour to your output window. Don't forget to donate...
Automatic Versions A recent addition to my toolset, this is awesome at controlling my versioning for releases
Mads Kristensen Last but by no means least, a huge thank you to Mads at Microsoft for some brilliant time saving tools that make Visual Studio just that little bit more brilliant (E.g. Markdown Editor, Add New File, Task Runner Explorer
Microsoft DevLabs Not sure why some of these aren't part of Visual Studio from the start but kudos to Microsoft for releasing them. Some excellent productivity enhancers here (E.g. Fix Mixed Tabs, Align Assignments