Is it possible to create a generic method with a definition similar to:
public static string GenerateWidget<TypeOfHtmlGen, WidgetType>(this HtmlHelper htmlHelper
, object modelData)
// TypeOfHtmlGenerator is a type that creates custom Html tags.
// GenerateWidget creates custom Html tags which contains Html representing the Widget.
I can use this method to create any kind of widget contained within any kind of Html tag.
Thanks
There’s a few improvements you might want to add, because it looks like you’re going to have to instanciate those classes within your method:
Also, you’re probably going to want the widget and html gen to implment some sort of interface or base class: