What can I do with Existential.Net?
Resolve Code Analysis issues
Existential.Net provides functionality that helps to resolve a couple of common Code Analysis issues.
- Resolving CA1062: Validate arguments of public methods
- Resolving CA2000: Dispose objects before losing scope
Work with nulls
Existential.Net provides a couple of ways of dealing with the absence of data.
The static Validate class provides methods that'll throw an exception if data doesn't meet their requirements - most commonly if a null is provided. They're very simple; but fail fast in a controlled manner, and reduce the amount of boiler-plate code required to do so.
- Validate: How To, Documentation
Maybe<T> provides an alternate approach. It's similar to Nullable<T>, in that it may or may not contain a value; but functions can be applied to it in a way that returns a Maybe of an independent type. That allows code to be written that postpones or eradicates the need to know whether there's a value.
Convert to IEnumerable<T>
Occasionally it's useful to be able to treat a single value as an IEnumerable<T>, or it would have been useful to have an IEnumerable actually be an IEnumerable<T>. Existential.Net provides conversions to enable that.
- GetGenericEnumerable<T>: Documentation
- GetGenericEnumerable: Documentation
Work with types
Existential provides a number of other small utility classes; to safely return an instance of IDisposable from a method, to calculate hash codes, to provide the name of the current method (without the need for reflection), and (using reflection) to report the name of a generic type in the form it's usually written.
- Disposable: How To, Documentation
- HashCodeHelper: Documentation
- ThisMethod: Documentation
- Type Extension Methods: Documentation