I have an extension method HtmlHelper that can take one template parameter of type T. Next, inside the method, I want to return to the editors for some fields an object marked with a special attribute. The problem is that I call this method, for example, from HtmlHelper <TModel>, but inside the method I need an instance of HtmlHelper <T> to use its editor method. I tried to create a default instance as follows:
var html = new HtmlHelper<T>(new ViewContext(), new ViewPage());
but of course this does not work.
So how can I create the correct instance?
source
share