IHtmlHelper.GetEnumSelectList Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetEnumSelectList(Type) |
Returns a select list for the given |
GetEnumSelectList<TEnum>() |
Returns a select list for the given |
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
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.