Class Validate
Provides common validation methods to simplify method parameter checks.
Inheritance
Inherited Members
Namespace:Microsoft.SqlTools.ServiceLayer.Utility
Assembly:Microsoft.SqlTools.ServiceLayer.dll
Syntax
public static class Validate
Methods
| Improve this Doc View SourceIsGreaterThan(String, Int32, Int32)
Throws ArgumentOutOfRangeException if the value is less than or equal to the given lower limit.
Declaration
public static void IsGreaterThan(string parameterName, int valueToCheck, int lowerLimit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| System.Int32 | valueToCheck | The value of the parameter being validated. |
| System.Int32 | lowerLimit | The lower limit which the value should be greater than. |
IsLessThan(String, Int32, Int32)
Throws ArgumentOutOfRangeException if the value is greater than or equal to the given upper limit.
Declaration
public static void IsLessThan(string parameterName, int valueToCheck, int upperLimit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| System.Int32 | valueToCheck | The value of the parameter being validated. |
| System.Int32 | upperLimit | The upper limit which the value should be less than. |
IsNotEqual<TValue>(String, TValue, TValue)
Throws ArgumentException if the value is equal to the undesired value.
Declaration
public static void IsNotEqual<TValue>(string parameterName, TValue valueToCheck, TValue undesiredValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| TValue | valueToCheck | The value of the parameter being validated. |
| TValue | undesiredValue | The value that valueToCheck should not equal. |
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of value to be validated. |
IsNotNull(String, Object)
Throws ArgumentNullException if value is null.
Declaration
public static void IsNotNull(string parameterName, object valueToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| System.Object | valueToCheck | The value of the parameter being validated. |
IsNotNullOrEmptyString(String, String)
Throws ArgumentException if the value is null or an empty string.
Declaration
public static void IsNotNullOrEmptyString(string parameterName, string valueToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| System.String | valueToCheck | The value of the parameter being validated. |
IsNotNullOrWhitespaceString(String, String)
Throws ArgumentException if the value is null, an empty string, or a string containing only whitespace.
Declaration
public static void IsNotNullOrWhitespaceString(string parameterName, string valueToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| System.String | valueToCheck | The value of the parameter being validated. |
IsWithinRange(String, Int32, Int32, Int32)
Throws ArgumentOutOfRangeException if the value is outside of the given lower and upper limits.
Declaration
public static void IsWithinRange(string parameterName, int valueToCheck, int lowerLimit, int upperLimit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | parameterName | The name of the parameter being validated. |
| System.Int32 | valueToCheck | The value of the parameter being validated. |
| System.Int32 | lowerLimit | The lower limit which the value should not be less than. |
| System.Int32 | upperLimit | The upper limit which the value should not be greater than. |