Guard
Guard copied to clipboard
Code guard in c#
I've ported your project to netcore 2.0. I took the opportunity to upgrade your nunit to v3 as well. All tests seem to pass. I generated a new nuget package...
Something like this: Implementation ```c# public static IArg WithExceptions(this IArg arg, Action handleErrorsAction) where T : IComparable { if (arg.Errors.Any()) { handleErrorsAction(arg.Value, arg.Errors); } return arg; } ``` Usage ```c#...
Here's an updated version of the solution to include a PCL library so it can be used by Xamarin/Silverlight/Store Apps.
Including CodeGuard in code that uses Code Contracts does not work because post-conditions cannot be checked and requires explicit assumes. Would you accept a PR for this?
Hi Given the following code: ``` public static class ForEachExtensions { public static void ForEach(this IEnumerable enumerable, Action action) { Guard.That(() => enumerable).IsNotNull(); Guard.That(() => action).IsNotNull(); foreach (T item in...
You can avoid CA1062 popping up by exposing a ValidatedNotNullAttribute in the library and then attributing it on the parameter in IsNotNull method. Probably won't work for expressions, but will...