Class Guard
A utility class to ensure that the provided arguments are correct.
Inherited Members
Namespace: IRM
Assembly: IRM.dll
Syntax
public static class Guard
Remarks
Methods
ArgumentMaxLength(String, Int32, String)
Checks a string argument to ensure that it isn't too long.
Declaration
public static void ArgumentMaxLength(string argumentValue, int maxLength, string argumentName)
Parameters
String
argumentValue
The argument value to check. |
System.Int32
maxLength
The max length of the string. |
String
argumentName
The name of the argument. |
ArgumentNotNull(Guid, String)
Checks an argument to ensure it isn't an empty System.Guid.
Declaration
public static void ArgumentNotNull(Guid argumentValue, string argumentName)
Parameters
System.Guid
argumentValue
The argument value to check. |
String
argumentName
The name of the argument. |
ArgumentNotNull(Object, String)
Checks an argument to ensure it isn't null
Declaration
public static void ArgumentNotNull(object argumentValue, string argumentName)
Parameters
Object
argumentValue
The argument value to check. |
String
argumentName
The name of the argument. |
ArgumentNotNullOrEmptyArray(Array, String)
Checks an array argument to ensure it isn't null or empty
Declaration
public static void ArgumentNotNullOrEmptyArray(Array argumentValue, string argumentName)
Parameters
System.Array
argumentValue
The argument value to check. |
String
argumentName
The name of the argument. |
ArgumentNotNullOrEmptyString(String, String)
Checks a string argument to ensure it isn't null or empty
Declaration
public static void ArgumentNotNullOrEmptyString(string argumentValue, string argumentName)
Parameters
String
argumentValue
The argument value to check. |
String
argumentName
The name of the argument. |
ColumnExists(DataRow, String, String)
Verifies that a column exists in the data table, that the row belongs too.
Declaration
public static void ColumnExists(DataRow row, string columnName, string argumentName)
Parameters
DataRow
row
The DataRow to check. |
String
columnName
The column name. |
String
argumentName
The argument name. |
ColumnExists(DataTable, String, String)
Verifies that a column exists in a data table.
Declaration
public static void ColumnExists(DataTable table, string columnName, string argumentName)
Parameters
System.Data.DataTable
table
The System.Data.DataTable to check. |
String
columnName
The column name. |
String
argumentName
The argument name. |
EnumValueIsDefined(Type, Int32, String)
Checks an Enum argument to ensure that its value is defined by the specified Enum type.
Declaration
public static void EnumValueIsDefined(Type enumType, int value, string argumentName)
Parameters
System.Type
enumType
The Enum type the value should correspond to. |
System.Int32
value
The value to check for. |
String
argumentName
The name of the argument holding the value. |
TypeIsAssignableFromType(Type, Type, String)
Verifies that an argument type is assignable from the provided type (meaning interfaces are implemented, or classes exist in the base class hierarchy).
Declaration
public static void TypeIsAssignableFromType(Type assignee, Type providedType, string argumentName)
Parameters
System.Type
assignee
The argument type. |
System.Type
providedType
The type it must be assignable from. |
String
argumentName
The argument name. |