title: How do I populate a dropdownlist with enum values?
body: <p>I have an enum for one of the properties of my view-model.  I want to display a drop-down list that contains all the values of the enum.  I can get this to work with the following code.</p>
  
  <p>What I'm wondering is whether there is a simple way to convert from an enum to an IEnumerable?  I can do it manually as in the following example, but when I add a new enum value the code breaks.  I imagine that I can do it via reflection as per this <a href="http://devlicio.us/blogs/joe_niland/archive/2006/10/10/Generic-Enum-to-List_3C00_T_3E00_-converter.aspx" rel="nofollow noreferrer">example</a>, but but are there other ways to do this?</p>
  
  <pre><code>public enum Currencies
  {
    CAD, USD, EUR
  }
  
  public ViewModel
  {
    [Required]
    public Currencies SelectedCurrency {get; set;}
  
    public SelectList Currencies
    {
      List&lt;Currencies&gt; c = new List&lt;Currencies&gt;();
      c.Add(Currencies.CAD);
      c.Add(Currencies.USD);
      c.Add(Currencies.EUR);
  
      return new SelectList(c);
    }
  }
  </code></pre>