Ensure.Net is a simple yet functional argument validation library.
- Simple to use.
- Support most needed functionality.
- Be available for most .NET frameworks.
- Take a fresh perspective.
public class YourClass
{
private IYourDependency _dependency;
private int _intValue;
private Guid _recordId;
public YourClass(IYourDependency dependency, int? intValue, Guid recordId)
{
_dependency = Ensure.NotNull(dependency).Value;
_intValue = Ensure.NotNull(intValue).Value;
_recordId = Ensure.NotDefault(recordId).Value;
}
...
}
...
public void YourMethod(IYourDependency dependency)
{
Ensure.NotNull(dependency);
...
}
...
Update ReSharper's settings to auto generate null checks using this library. Refer to this .DotSettings file for an example.