title: EnumHelper.GetSelectList in controller
body: <p>I simply want to use the above subject to populate a list of predefined Enum values in a dropdownlist, but am running up against syntactical issues.</p>
  
  <p>For example, if I just want to populate a dropdownlist (not associated with any enums, the following code will suffice):</p>
  
  <pre><code>List&lt;CustomerDDL&gt; customerList = await db.GetCustomerDDLAsync();
              ViewBag.CustomerID = new SelectList(customerList, "CustomerID", "Email", project.CustomerID);
  </code></pre>
  
  <p>However, if I want to populate a dropdownlist consisting of enum values, the following syntax doesn't work. I get a design time compiler error of: </p>
  
  <pre><code>'YeagerTechDB.Enums.CategoryTypeEnum' is a 'type', but used like a 'variable'. 
  </code></pre>
  
  <p>I know what the error implies, but simply do not know how to syntactically construct the SelectList.</p>
  
  <p>I have the following line trying to create it which is giving me the error. Note that this code is inside my <strong>controller</strong> in order to select the selected value.</p>
  
  <pre><code>ViewData["Categories"] = new CategoriesDDL();
              List&lt;CategoriesDDL&gt; categoryList = EnumHelper.GetSelectList(ViewData.ModelMetadata, (System.Enum)CategoryTypeEnum);
  ViewBag.CategoryID = new SelectList(categoryList, "CategoryID", "CategoryDescription", project.CategoryID);
  </code></pre>
  
  <p>My Enum model is defined as follows:</p>
  
  <pre><code>using System;
  using System.ComponentModel.DataAnnotations;
  using System.Runtime.Serialization;
  
  namespace YeagerTechDB.Enums
  {
      [Serializable, DataContract(IsReference = true)]
      public enum CategoryTypeEnum : short
      {
          [EnumMember]
          [Display(Name = "Medical")]
          Medical = 9,
          [EnumMember]
          [Display(Name = "Financial")]
          Financial = 10,
          [EnumMember]
          [Display(Name = "Logistics")]
          Logistics = 11,
          [EnumMember]
          [Display(Name = "Accounting")]
          Accounting = 12
      }
  }
  </code></pre>
  
  <p>Can someone please help me out with the exact syntax I need for the SelectList?</p>