Class Arg<T>
Provides argument validation helpers that throw ArgumentException instances.
public class Arg<T> : CheckBase<T>
Type Parameters
TType of the argument to validate.
- Inheritance
-
CheckBase<T>Arg<T>
- Inherited Members
- Extension Methods
Constructors
Arg(T, string)
Initializes a new instance of the Arg<T> class.
public Arg(T value, string name = "")
Parameters
valueTArgument value to validate.
namestringName of the argument being validated.
Methods
OnNull()
Handles the null-case for the value.
protected override void OnNull()
ThrowErrors()
Throws the accumulated validation errors.
public override void ThrowErrors()
Remarks
When exactly one error has been recorded, it is rethrown directly (preserving type and stack). When multiple errors were recorded, they are wrapped in an AggregateException so all individual causes remain accessible (#64).
Exceptions
- AggregateException
Thrown when more than one validation error was recorded.