I have a class like this with a generic type:
Document<T>
This class is part of a view model
public class MyViewModel
{
public IEnumerable<Document<T>> Documents {get;set;}
}
I'd like to use DisplayFor to dispatch to the appropriate template in the view.cshtml
@model MyViewModel
foreach(var vm in Model.Documents)
{
@Html.DisplayFor(vm)
}
But I don't know how to create templates in Shared/DisplayTemplates that have a name of the class, but the C# name omits the generic parameters:
Document`1
But this is insufficent, as it doesn't identify the full type structure.
Is there a way to use DisplayFor with DisplayTemplates and Generic Types?