[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum

ValidateEnum Method

ValidateEnum(object, Type)

Validates an enum value against the specified type.

Declaration
public static void ValidateEnum(object value, Type type)
Parameters
Type Name Description
object value

An Enum value to validate.

Type type

A Type to validate the value against.

Examples
BorderDrawingStyle value = BorderDrawingStyle.Solid;
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle));
Exceptions
Type Condition
InvalidEnumArgumentException

Throws if the value is not against the specified type.

ValidateEnum(ExpressionInfo, Type)

Validates an expression value to make sure it is valid enum value and against the specified type.

Declaration
public static void ValidateEnum(ExpressionInfo expression, Type type)
Parameters
Type Name Description
ExpressionInfo expression

An ExpressionInfo value to validate.

Type type

A Type to validate the value against.

Examples
ExpressionInfo value = ExpressionInfo.FromString("Solid");
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle));
Exceptions
Type Condition
InvalidEnumArgumentException

Throws if the value is not against the specified type.

ValidateEnum(ExpressionInfo, Type, IList<string>)

Validates an expression value to make sure it is valid enum value and against the specified type.

Declaration
public static void ValidateEnum(ExpressionInfo expression, Type type, IList<string> additionalValues)
Parameters
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.

Examples
ExpressionInfo value = ExpressionInfo.FromString("Solid");
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle), new[] { "Transparent"});
Exceptions
Type Condition
InvalidEnumArgumentException

Throws if the value is not against the specified type.