title: CSV Media Type Formatter for ASP.NET Web API
body: <p>I tried to implement a CSV MediaTypeFormatter for my Web API as described here:
  <a href="http://www.tugberkugurlu.com/archive/creating-custom-csvmediatypeformatter-in-asp-net-web-api-for-comma-separated-values-csv-format" rel="nofollow">http://www.tugberkugurlu.com/archive/creating-custom-csvmediatypeformatter-in-asp-net-web-api-for-comma-separated-values-csv-format</a></p>
  
  <p>(I don't want to paste in all the code from there)</p>
  
  <p>But I don't get it to work using the Web API Controller below.
  I used Fiddler to call the Web API with: <a href="http://myhostname.com/api/csvexport?format=csv" rel="nofollow">http://myhostname.com/api/csvexport?format=csv</a></p>
  
  <pre><code>public dynamic Get()
      {
  
          var ret = new[] { "CarId", "Make", "Model", "Name" }; 
          return ret;
      } 
  </code></pre>
  
  <p>For "type" in the CsvFormatter i get a:</p>
  
  <p>DeclaringMethod = 'type.DeclaringMethod' threw an exception of type 'System.InvalidOperationException'</p>
  
  <p>with </p>
  
  <p>Method may only be called on a Type for which Type.IsGenericParameter is true.</p>
  
  <p>So I might not get the concept of the Formatter right and have a problem with the type?</p>