Search code examples
c#.netstaticextension-methods

Why can't static method in non-static class be an extension method?


Possible Duplicate:
extension method requires class to be static
Why aren't C# static class extension methods supported?

In .NET:

Why can't static method in non-static class be an extension method?


Solution

  • Eric Lippert will probably weigh in with a really good answer on this one, but the gist of it will probably be:

    We decided it would be easier on both programmers and the compiler if we limit the number of places that you have to look for extension methods.

    This policy tends to force users to put all of their extension methods into a few specific classes that are designated for this purpose.