Help With Generics? How to Define Generic Method?

Posted by DaveDev on Stack Overflow See other posts from Stack Overflow or by DaveDev
Published on 2010-03-26T21:29:14Z Indexed on 2010/03/26 21:33 UTC
Read the original article Hit count: 95

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics