title: Using enum for dropdown list in ASP.NET MVC Core
body: <p>I'm trying to create a dropdown list with an enum property in ASP.NET MVC Core using the tag helper in a Razor view:</p>
  
  <p>Here is the model:</p>
  
  <pre><code>public class PersonalMember : Member
  {
      [Required, Display(Name = "First Name")]
      public string FirstName { get; set; }
  
      [Required, Display(Name = "Last Name")]
      public string LastName { get; set; }
  
      [EnumDataType(typeof(Gender))]
      public Gender GenderType { get; set; }
  }
  
  public enum Gender
  {
      Male = 1,
      Female = 2
  }
  </code></pre>
  
  <p>Here is part of a form in the view:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label asp-for="GenderType" class="col-md-2 control-label"&gt;&lt;/label&gt;
      &lt;div class="col-md-10"&gt;
          &lt;select asp-for="GenderType" asp-items="Html.GetEnumSelectList&lt;GenderType&gt;()"&gt;
              &lt;option selected="selected" value=""&gt;Please select&lt;/option&gt;
          &lt;/select&gt;
          &lt;span asp-validation-for="GenderType" class="text-danger" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem I'm having is that after <code>Html.GetEnumSelectList</code>, <code>GenderType</code> is not recognized and shows up as an error.</p>
  
  <p>Does anyone know how to solve this?</p>