Class ParameterValidator
Contains strongly typed validation methods
Inheritance
System.Object
ParameterValidator
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Validation
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0Syntax
public class ParameterValidator
Constructors
ParameterValidator()
Declaration
public ParameterValidator()
Methods
ThrowIfNull<T>(Expression<Func<T>>, T)
Throws an System.ArgumentNullException based on
Declaration
public static void ThrowIfNull<T>(Expression<Func<T>> expression, T value)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T>> | expression | An expression containing the property to validate |
T | value | the property again |
Type Parameters
Name | Description |
---|---|
T | The type in the expression |
Examples
If your property has a parameter named "foo" you can use this:
ParameterValidator.ThrowIfNull(() => foo, foo);
ThrowIfNullOrEmpty(Expression<Func<String>>, String)
Throws an System.ArgumentNullException based on
Declaration
public static void ThrowIfNullOrEmpty(Expression<Func<string>> expression, string value)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<System.String>> | expression | An expression containing the property to validate |
System.String | value | the property again |
Examples
If your property has a string parameter named "foo" you can use this:
ParameterValidator.ThrowIfNullOrEmpty(() => foo, foo);