Problem
When coding in MVC , i Came across this or similar error message:
"Unable to cast object of type '<>f__AnonymousType1`1[myType]' to type myType"
Background
I had been getting used to wrapping parameters in new{} when passing data from the controller to the view.
This error message was saying, i can't convert you class to your class. The new{} statement wrapping my object was changing it to an 'anonymous type'. So how did i fix it?
Solution...
I found that removing the new{} section of the code solved this for me.