title: Passing an enum as an annotation parameter and getting list of items
body: <p>I created a custom attribute, that will be used to define that the property is used in a DropDownList. So the code of attribute is this:</p>
  
  <pre><code>public class DropDownList : Attribute
  {
      public Type EnumType { get; set; }
  
      public DropDownList(Type type)
      {
          this.EnumType = type;
      }
  }
  </code></pre>
  
  <p>I can't pass the enum as paramater, I only could do this passing the type of enum, like this:</p>
  
  <pre><code>class TestViewModel
  {
      [DropDownList(typeof(MyEnums.EnumTest)]
      public int MyProp {get; set;}
  }
  </code></pre>
  
  <p>I have a HTML extension, that needs to work like this:</p>
  
  <pre><code>public HtmlString AddSelectFor&lt;TValue&gt;(Expression&lt;Func&lt;TModel, TValue&gt;&gt; expression)
  {
      var memberExpression = expression.Body as MemberExpression;
      var attribute = memberExpression.Member.GetCustomAttributes(typeof(MyProj.Attributes.DropDownList), false).FirstOrDefault() as MyProj.Attributes.DropDownList;
  
      // HERE i need to get the list of enum itens
      var items = Enum.GetValues(attribute.EnumType);
      return HtmlHelper.DropDownListFor(expression, list);
  }
  </code></pre>
  
  <p>The problem is that I don't have the enum, I have only the type, because it needs to be generic. So I can't do the cast to create the list needed as parameter for "HtmlHelper.DropDownListFor".</p>