I am wondering if I can use extension method or other techniques to extend static class like
System.Net.Mime.MediaTypeNames.Image, it has fewer type than I need.
I am wondering if I can use extension method or other techniques to extend
Share
No, extension methods can only be used to add instance methods, not static methods (or even properties). Extension methods are really just syntactic sugar around static methods. For instance, when you use an extension method such as Count():
This is actually compiled to:
You can’t add additional static methods to an existing class using extension methods.