EnumHelper.IsValidForEnumHelper Method

 

Gets a value indicating whether the given values are valid for enum helper.

Namespace:   System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticIsValidForEnumHelper(ModelMetadata)

Gets a value indicating whether the given metadata or associated expression is suitable for use in GetSelectList and EnumDropDownListFor<'TModel, 'TEnum> calls.

System_CAPS_pubmethodSystem_CAPS_staticIsValidForEnumHelper(Type)

Gets a value indicating whether the given type or an expression of this type is suitable for use in GetSelectList and EnumDropDownListFor<'TModel, 'TEnum> calls.

Return to top

EnumHelper.IsValidForEnumHelper Method (ModelMetadata)

Gets a value indicating whether the given metadata or associated expression is suitable for use in GetSelectList and EnumDropDownListFor<'TModel, 'TEnum> calls.

static member IsValidForEnumHelper : 
        metadata:ModelMetadata -> bool

Parameters

metadata
Type: System.Web.Mvc.ModelMetadata

The metadata to check.

Return Value

Type: System.Boolean

true if GetSelectList will return not throw when passed given ModelMetadata and EnumDropDownListFor<'TModel, 'TEnum> will not throw when passed associated expression; otherwise, false.

Currently returns true if the metadata parameter is not null and IsValidForEnumHelper returns true for metadata.ModelType.

Return to top

EnumHelper.IsValidForEnumHelper Method (Type)

Gets a value indicating whether the given type or an expression of this type is suitable for use in GetSelectList and EnumDropDownListFor<'TModel, 'TEnum> calls.

static member IsValidForEnumHelper : 
        type:Type -> bool

Parameters

type
Type: System.Type

The type to check.

Return Value

Type: System.Boolean

true if GetSelectList will not throw when passed the given type and EnumDropDownListFor<'TModel, 'TEnum> will not throw when passed an expression of this type; otherwise, false.

Currently returns true if the type parameter is not null, is an enum type, and does not have a FlagsAttribute attribute.

Return to top
Show: