title: Pass collection of enums to ASP.NET MVC ActionMethod
body: <p>Is there a way to pass a collection of Enums to an ActionMethod (on a GET) automatically?</p>
  
  <p>For example, if I have the following enum definition:</p>
  
  <pre><code>enum DaysEnum {Sat, Sun, Mon, Tue, Wed, Thu, Fri};
  </code></pre>
  
  <p>and, I have an ActionMethod definition of:</p>
  
  <pre><code>ActionResult SampleActionMethod ( List&lt;DaysEnum&gt; days)
  </code></pre>
  
  <p>Is there a way I could render, in a View, a URL that would pass in a collection of DayEnums. Something like:</p>
  
  <pre><code>var someDays = new List&lt;DaysEnum&gt; {DaysEnum.Sat, DaysEnum.Sun, DaysEnum.Mon};
  
  Url.Route(new { days = someDays, controller="whatever", action="SampleActionMethod"});
  </code></pre>
  
  <p>The default model binder doesn't seem to support this, since I'm currently getting the following rendered:</p>
  
  <pre><code>http://.../System.Collections.Generic.List`1[DaysEnum]
  </code></pre>
  
  <p>I know I can do this by manually flattening the collection to, say, a dash-deliniated string, and then recreate the collection in the ActionMethod, but I was looking at something more elegant. Various <a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx" rel="nofollow">blog</a> <a href="http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx" rel="nofollow">posts</a> talk about passing in collections, but that is more about when doing POSTS.</p>