Class Guard
Provides common validation methods shared across the framework entities. This class cannot be inherited.
Inheritance
Inherited Members
Namespace: Argotic.Common
Assembly: Argotic.Common.dll
Syntax
public static class Guard
Methods
| Improve this Doc View SourceArgumentNotGreaterThan(Decimal, String, Decimal)
Validates that the supplied value
is not greater than the specified maximum.
Declaration
public static void ArgumentNotGreaterThan(decimal value, string name, decimal maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Decimal | maximum | The maximum acceptable value. |
Remarks
If the value
is greater than the specified maximum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotGreaterThan(Int32, String, Int32)
Validates that the supplied value
is not greater than the specified maximum.
Declaration
public static void ArgumentNotGreaterThan(int value, string name, int maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int32 | maximum | The maximum acceptable value. |
Remarks
If the value
is greater than the specified maximum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotGreaterThan(Int64, String, Int64)
Validates that the supplied value
is not greater than the specified maximum.
Declaration
public static void ArgumentNotGreaterThan(long value, string name, long maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int64 | maximum | The maximum acceptable value. |
Remarks
If the value
is greater than the specified maximum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotLessThan(Decimal, String, Decimal)
Validates that the supplied value
is not less than the specified minimum.
Declaration
public static void ArgumentNotLessThan(decimal value, string name, decimal minimum)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Decimal | minimum | The minimum acceptable value. |
Remarks
If the value
is less than the specified minimum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotLessThan(Int32, String, Int32)
Validates that the supplied value
is not less than the specified minimum.
Declaration
public static void ArgumentNotLessThan(int value, string name, int minimum)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int32 | minimum | The minimum acceptable value. |
Remarks
If the value
is less than the specified minimum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotLessThan(Int64, String, Int64)
Validates that the supplied value
is not less than the specified minimum.
Declaration
public static void ArgumentNotLessThan(long value, string name, long minimum)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int64 | minimum | The minimum acceptable value. |
Remarks
If the value
is less than the specified minimum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotNull(Object, String)
Validates that the supplied value
is not a null reference.
Declaration
public static void ArgumentNotNull(object value, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
Remarks
If the value
is a null reference, an System.ArgumentNullException is raised using the supplied name
.
ArgumentNotNullOrEmptyString(String, String)
Validates that the supplied value
is not a null reference or an empty string.
Declaration
public static void ArgumentNotNullOrEmptyString(string value, string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
Remarks
If the value
is a null reference or an empty string, an System.ArgumentNullException is raised using the supplied name
.
ArgumentNotOutOfRange(Decimal, String, Int32, Decimal)
Validates that the supplied value
is within the specified range.
Declaration
public static void ArgumentNotOutOfRange(decimal value, string name, int minimum, decimal maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int32 | minimum | The minimum acceptable value of the range. |
System.Decimal | maximum | The maximum acceptable value of the range. |
Remarks
If the value
is less than the specified minimum
or greater than the specified maximum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotOutOfRange(Int32, String, Int32, Int32)
Validates that the supplied value
is within the specified range.
Declaration
public static void ArgumentNotOutOfRange(int value, string name, int minimum, int maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int32 | minimum | The minimum acceptable value of the range. |
System.Int32 | maximum | The maximum acceptable value of the range. |
Remarks
If the value
is less than the specified minimum
or greater than the specified maximum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.
ArgumentNotOutOfRange(Int64, String, Int32, Int64)
Validates that the supplied value
is within the specified range.
Declaration
public static void ArgumentNotOutOfRange(long value, string name, int minimum, long maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value of the method argument to validate. |
System.String | name | The name of the method argument. |
System.Int32 | minimum | The minimum acceptable value of the range. |
System.Int64 | maximum | The maximum acceptable value of the range. |
Remarks
If the value
is less than the specified minimum
or greater than the specified maximum
,
an System.ArgumentOutOfRangeException is raised using the supplied name
.