HtmlHelper.GetEnumSelectList Method

Definition

Overloads

GetEnumSelectList(ModelMetadata)

Returns a select list for the given metadata.

GetEnumSelectList(Type)

Returns a select list for the given enumType.

GetEnumSelectList<TEnum>()

Returns a select list for the given TEnum.

GetEnumSelectList(ModelMetadata)

Source:
HtmlHelper.cs
Source:
HtmlHelper.cs
Source:
HtmlHelper.cs

Returns a select list for the given metadata.

protected:
 virtual System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Mvc::Rendering::SelectListItem ^> ^ GetEnumSelectList(Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^ metadata);
protected virtual System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> GetEnumSelectList (Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata metadata);
abstract member GetEnumSelectList : Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata -> seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>
override this.GetEnumSelectList : Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata -> seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>
Protected Overridable Function GetEnumSelectList (metadata As ModelMetadata) As IEnumerable(Of SelectListItem)

Parameters

metadata
ModelMetadata

ModelMetadata to generate a select list for.

Returns

An IEnumerable<T> containing the select list for the given metadata.

Exceptions

Thrown if metadata's ModelType is not an Enum or if it has a FlagsAttribute.

Applies to

GetEnumSelectList(Type)

Source:
HtmlHelper.cs
Source:
HtmlHelper.cs
Source:
HtmlHelper.cs

Returns a select list for the given enumType.

public:
 virtual System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Mvc::Rendering::SelectListItem ^> ^ GetEnumSelectList(Type ^ enumType);
public System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> GetEnumSelectList (Type enumType);
abstract member GetEnumSelectList : Type -> seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>
override this.GetEnumSelectList : Type -> seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>
Public Function GetEnumSelectList (enumType As Type) As IEnumerable(Of SelectListItem)

Parameters

enumType
Type

Type to generate a select list for.

Returns

An IEnumerable<T> containing the select list for the given enumType.

Implements

Applies to

GetEnumSelectList<TEnum>()

Source:
HtmlHelper.cs
Source:
HtmlHelper.cs
Source:
HtmlHelper.cs

Returns a select list for the given TEnum.

public:
generic <typename TEnum>
 where TEnum : value class virtual System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Mvc::Rendering::SelectListItem ^> ^ GetEnumSelectList();
public System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> GetEnumSelectList<TEnum> () where TEnum : struct;
abstract member GetEnumSelectList : unit -> seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> (requires 'Enum : struct)
override this.GetEnumSelectList : unit -> seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> (requires 'Enum : struct)
Public Function GetEnumSelectList(Of TEnum As Structure) () As IEnumerable(Of SelectListItem)

Type Parameters

TEnum

Type to generate a select list for.

Returns

An IEnumerable<T> containing the select list for the given TEnum, with a decimal representation of the ordinal as Value and the display name as Text.

Implements

Applies to