Share via


IHtmlHelper.GetEnumSelectList Method

Definition

Overloads

GetEnumSelectList(Type)

Returns a select list for the given enumType.

GetEnumSelectList<TEnum>()

Returns a select list for the given TEnum.

GetEnumSelectList(Type)

Source:
IHtmlHelper.cs

Returns a select list for the given enumType.

public:
 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>
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.

Exceptions

Thrown if enumType is not an Enum or if it has a FlagsAttribute.

Applies to

GetEnumSelectList<TEnum>()

Source:
IHtmlHelper.cs

Returns a select list for the given TEnum.

public:
generic <typename TEnum>
 where TEnum : value class 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)
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.

Exceptions

Thrown if TEnum is not an Enum or if it has a FlagsAttribute.

Applies to