Extension methods on a static object
- by Max Malygin
I know (or so I hear) that writing extension methods for a single stand alone .net class (not an implementation of IEnumerable) is potential code smell. However, for the sake of making the life easier I need to attach a method to the ConfigurationManager class in asp.net. It's a static object so this won't work:
public static List<string> GetSupportedDomains(this ConfigurationManager manager)
{
//the manager needs to be static.
}
So the question is - is it possible to write an extension method for a static class in .net?