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