0

Normally, extension method can be created for non-static class:

public static string Resource(this HtmlHelper htmlHelper)
{
    //TO DO
}

But if HtmlHelper is a static class, I cannot do it anymore. so how can i do?

Tardis Xu
  • 1,161
  • 2
  • 7
  • 9
  • 3
    You can't - you can never have an _instance_ of that class, so an extension method is irrelevant. How would you expect to use it? Answering that might shed more light on your intentions. – Grant Thomas Jun 26 '13 at 12:35
  • As Grant said, maybe consider why you want this syntax. You could subclass the static class and add more static methods if you are trying to unify, yet extend, your static methods. – Will Custode Jun 26 '13 at 12:38

0 Answers0