EnumHelper.IsValidForEnumHelper Method

Definition

Overloads

IsValidForEnumHelper(Type)

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

IsValidForEnumHelper(ModelMetadata)

Gets a value indicating whether the given metadata or associated expression is suitable for use in GetSelectList(ModelMetadata) and EnumDropDownListFor<TModel,TEnum>(HtmlHelper<TModel>, Expression<Func<TModel,TEnum>>) calls.

IsValidForEnumHelper(Type)

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

public static bool IsValidForEnumHelper (Type type);
static member IsValidForEnumHelper : Type -> bool
Public Shared Function IsValidForEnumHelper (type As Type) As Boolean

Parameters

type
Type

The type to check.

Returns

true if GetSelectList(Type) will not throw when passed the given type and EnumDropDownListFor<TModel,TEnum>(HtmlHelper<TModel>, Expression<Func<TModel,TEnum>>) will not throw when passed an expression of this type; otherwise, false.

Applies to

IsValidForEnumHelper(ModelMetadata)

Gets a value indicating whether the given metadata or associated expression is suitable for use in GetSelectList(ModelMetadata) and EnumDropDownListFor<TModel,TEnum>(HtmlHelper<TModel>, Expression<Func<TModel,TEnum>>) calls.

public static bool IsValidForEnumHelper (System.Web.Mvc.ModelMetadata metadata);
static member IsValidForEnumHelper : System.Web.Mvc.ModelMetadata -> bool
Public Shared Function IsValidForEnumHelper (metadata As ModelMetadata) As Boolean

Parameters

metadata
ModelMetadata

The metadata to check.

Returns

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

Applies to