[]
Validates an enum value against the specified type.
public static void ValidateEnum(object value, Type type)
| Type | Name | Description |
|---|---|---|
| object | value | An Enum value to validate. |
| Type | type | A Type to validate the value against. |
BorderDrawingStyle value = BorderDrawingStyle.Solid;
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle));
| Type | Condition |
|---|---|
| InvalidEnumArgumentException | Throws if the value is not against the specified type. |
Validates an expression value to make sure it is valid enum value and against the specified type.
public static void ValidateEnum(ExpressionInfo expression, Type type)
| Type | Name | Description |
|---|---|---|
| ExpressionInfo | expression | An ExpressionInfo value to validate. |
| Type | type | A Type to validate the value against. |
ExpressionInfo value = ExpressionInfo.FromString("Solid");
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle));
| Type | Condition |
|---|---|
| InvalidEnumArgumentException | Throws if the value is not against the specified type. |
Validates an expression value to make sure it is valid enum value and against the specified type.
public static void ValidateEnum(ExpressionInfo expression, Type type, IList<string> additionalValues)
| Type | Name | Description |
|---|---|---|
| ExpressionInfo | expression | An ExpressionInfo value to validate. |
| Type | type | A Type to validate the value against. |
| IList<string> | additionalValues | The additional allowed values. |
ExpressionInfo value = ExpressionInfo.FromString("Solid");
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle), new[] { "Transparent"});
| Type | Condition |
|---|---|
| InvalidEnumArgumentException | Throws if the value is not against the specified type. |