C# Class Smrf.AppLib.ArgumentChecker

Contains methods that check method arguments and property values.
This can be used by a class that wants to check values passed to its property setters and arguments passed to its methods. The CheckXXX() methods in this class throw an exception if a parameter value or method argument is invalid.

This class is marked internal to avoid compiler error CS0433 ("The type ... exists in both ...") when an executable references two or more assemblies that use this class.

Inheritance: Object
Show file Open project: 2014-sed-team3/term-project Class Usage Examples

Protected Properties

Property Type Description
m_sOwnerClassName String

Public Methods

Method Description
ArgumentChecker ( String sOwnerClassName ) : System

Initializes a new instance of the ArgumentChecker class.

CheckArgumentInRange ( String sMethodName, String sArgumentName, Double dArgumentValue, Double dMinimumValidValue, Double dMaximumValidValue ) : void
CheckArgumentIsDefined ( String sMethodName, String sArgumentName, Object oArgumentValue, Type oEnumType ) : void
CheckArgumentNotEmpty ( String sMethodName, String sArgumentName, String sArgumentValue ) : void
CheckArgumentNotNegative ( String sMethodName, String sArgumentName, Int32 iArgumentValue ) : void
CheckArgumentNotNegative ( String sMethodName, String sArgumentName, System.Int64 lArgumentValue ) : void
CheckArgumentNotNull ( String sMethodName, String sArgumentName, Object oArgumentValue ) : void
CheckArgumentPositive ( String sMethodName, String sArgumentName, Double dArgumentValue ) : void
CheckArgumentPositive ( String sMethodName, String sArgumentName, Int32 iArgumentValue ) : void
CheckArgumentPositive ( String sMethodName, String sArgumentName, System.Int64 lArgumentValue ) : void
CheckPropertyInRange ( String sPropertyName, Double dPropertyValue, Double dMinimumValidValue, Double dMaximumValidValue ) : void
CheckPropertyInRange ( String sPropertyName, Int32 iPropertyValue, Int32 iMinimumValidValue, Int32 iMaximumValidValue ) : void
CheckPropertyInRange ( String sPropertyName, System.Single fPropertyValue, System.Single fMinimumValidValue, System.Single fMaximumValidValue ) : void
CheckPropertyIsDefined ( String sPropertyName, Object oPropertyValue, Type oEnumType ) : void
CheckPropertyNotEmpty ( String sPropertyName, String sPropertyValue ) : void
CheckPropertyNotEqual ( String sPropertyName, Int32 iPropertyValue, Int32 iInvalidValue ) : void
CheckPropertyNotEqual ( String sPropertyName, String sPropertyValue, String sInvalidValue ) : void
CheckPropertyNotNegative ( String sPropertyName, Int32 iPropertyValue ) : void
CheckPropertyNotNull ( String sPropertyName, Object oPropertyValue ) : void
CheckPropertyPositive ( String sPropertyName, Decimal decPropertyValue ) : void
CheckPropertyPositive ( String sPropertyName, Double dPropertyValue ) : void
CheckPropertyPositive ( String sPropertyName, Int32 iPropertyValue ) : void
ThrowArgumentException ( String sMethodName, String sArgumentName, String sMessageDetails ) : void
ThrowArgumentException ( String sMethodName, String sArgumentName, String sMessageDetails, Exception oInnerException ) : void
ThrowPropertyException ( String sPropertyName, String sMessageDetails ) : void
ThrowPropertyException ( String sPropertyName, String sMessageDetails, Exception oInnerException ) : void

Private Methods

Method Description
AssertValid ( ) : void

Method Details

ArgumentChecker() public method

Initializes a new instance of the ArgumentChecker class.
public ArgumentChecker ( String sOwnerClassName ) : System
sOwnerClassName String /// Class name of the object that created this object. The class name gets /// prepended to all exception messages. Sample: "MyClass". ///
return System

CheckArgumentInRange() public method

public CheckArgumentInRange ( String sMethodName, String sArgumentName, Double dArgumentValue, Double dMinimumValidValue, Double dMaximumValidValue ) : void
sMethodName String
sArgumentName String
dArgumentValue Double
dMinimumValidValue Double
dMaximumValidValue Double
return void

CheckArgumentIsDefined() public method

public CheckArgumentIsDefined ( String sMethodName, String sArgumentName, Object oArgumentValue, Type oEnumType ) : void
sMethodName String
sArgumentName String
oArgumentValue Object
oEnumType System.Type
return void

CheckArgumentNotEmpty() public method

public CheckArgumentNotEmpty ( String sMethodName, String sArgumentName, String sArgumentValue ) : void
sMethodName String
sArgumentName String
sArgumentValue String
return void

CheckArgumentNotNegative() public method

public CheckArgumentNotNegative ( String sMethodName, String sArgumentName, Int32 iArgumentValue ) : void
sMethodName String
sArgumentName String
iArgumentValue System.Int32
return void

CheckArgumentNotNegative() public method

public CheckArgumentNotNegative ( String sMethodName, String sArgumentName, System.Int64 lArgumentValue ) : void
sMethodName String
sArgumentName String
lArgumentValue System.Int64
return void

CheckArgumentNotNull() public method

public CheckArgumentNotNull ( String sMethodName, String sArgumentName, Object oArgumentValue ) : void
sMethodName String
sArgumentName String
oArgumentValue Object
return void

CheckArgumentPositive() public method

public CheckArgumentPositive ( String sMethodName, String sArgumentName, Double dArgumentValue ) : void
sMethodName String
sArgumentName String
dArgumentValue Double
return void

CheckArgumentPositive() public method

public CheckArgumentPositive ( String sMethodName, String sArgumentName, Int32 iArgumentValue ) : void
sMethodName String
sArgumentName String
iArgumentValue System.Int32
return void

CheckArgumentPositive() public method

public CheckArgumentPositive ( String sMethodName, String sArgumentName, System.Int64 lArgumentValue ) : void
sMethodName String
sArgumentName String
lArgumentValue System.Int64
return void

CheckPropertyInRange() public method

public CheckPropertyInRange ( String sPropertyName, Double dPropertyValue, Double dMinimumValidValue, Double dMaximumValidValue ) : void
sPropertyName String
dPropertyValue Double
dMinimumValidValue Double
dMaximumValidValue Double
return void

CheckPropertyInRange() public method

public CheckPropertyInRange ( String sPropertyName, Int32 iPropertyValue, Int32 iMinimumValidValue, Int32 iMaximumValidValue ) : void
sPropertyName String
iPropertyValue System.Int32
iMinimumValidValue System.Int32
iMaximumValidValue System.Int32
return void

CheckPropertyInRange() public method

public CheckPropertyInRange ( String sPropertyName, System.Single fPropertyValue, System.Single fMinimumValidValue, System.Single fMaximumValidValue ) : void
sPropertyName String
fPropertyValue System.Single
fMinimumValidValue System.Single
fMaximumValidValue System.Single
return void

CheckPropertyIsDefined() public method

public CheckPropertyIsDefined ( String sPropertyName, Object oPropertyValue, Type oEnumType ) : void
sPropertyName String
oPropertyValue Object
oEnumType System.Type
return void

CheckPropertyNotEmpty() public method

public CheckPropertyNotEmpty ( String sPropertyName, String sPropertyValue ) : void
sPropertyName String
sPropertyValue String
return void

CheckPropertyNotEqual() public method

public CheckPropertyNotEqual ( String sPropertyName, Int32 iPropertyValue, Int32 iInvalidValue ) : void
sPropertyName String
iPropertyValue System.Int32
iInvalidValue System.Int32
return void

CheckPropertyNotEqual() public method

public CheckPropertyNotEqual ( String sPropertyName, String sPropertyValue, String sInvalidValue ) : void
sPropertyName String
sPropertyValue String
sInvalidValue String
return void

CheckPropertyNotNegative() public method

public CheckPropertyNotNegative ( String sPropertyName, Int32 iPropertyValue ) : void
sPropertyName String
iPropertyValue System.Int32
return void

CheckPropertyNotNull() public method

public CheckPropertyNotNull ( String sPropertyName, Object oPropertyValue ) : void
sPropertyName String
oPropertyValue Object
return void

CheckPropertyPositive() public method

public CheckPropertyPositive ( String sPropertyName, Decimal decPropertyValue ) : void
sPropertyName String
decPropertyValue Decimal
return void

CheckPropertyPositive() public method

public CheckPropertyPositive ( String sPropertyName, Double dPropertyValue ) : void
sPropertyName String
dPropertyValue Double
return void

CheckPropertyPositive() public method

public CheckPropertyPositive ( String sPropertyName, Int32 iPropertyValue ) : void
sPropertyName String
iPropertyValue System.Int32
return void

ThrowArgumentException() public method

public ThrowArgumentException ( String sMethodName, String sArgumentName, String sMessageDetails ) : void
sMethodName String
sArgumentName String
sMessageDetails String
return void

ThrowArgumentException() public method

public ThrowArgumentException ( String sMethodName, String sArgumentName, String sMessageDetails, Exception oInnerException ) : void
sMethodName String
sArgumentName String
sMessageDetails String
oInnerException System.Exception
return void

ThrowPropertyException() public method

public ThrowPropertyException ( String sPropertyName, String sMessageDetails ) : void
sPropertyName String
sMessageDetails String
return void

ThrowPropertyException() public method

public ThrowPropertyException ( String sPropertyName, String sMessageDetails, Exception oInnerException ) : void
sPropertyName String
sMessageDetails String
oInnerException System.Exception
return void

Property Details

m_sOwnerClassName protected property

protected String m_sOwnerClassName
return String