Support for generics in razor view
It would be great if razor views could support generic models.
Martijn Hoekstra commented
This is especially useful for me for number types that don't share a common supertype (int, float, decimal, double, long, byte) and want to keep generic in the model, but use the same view for
Nico Sap commented
If i'm not mistaking, i used dynamic once in my views.
That could solve the problem, doesn't it? :)
This request is about open generics.
We currently support closed generics. Is that sufficient? Or is the request here specifically about open generics?
Tom Potts commented
It should support the where keyword too, either within the model statement or in a separate directive. For example,
@model IEnumerable<T> where T : MyBaseClass
Yes, it's really important feature.
At least support this for layouts.