When it comes to extension methods, class names don't seem to do anything, but provide a grouping, which is what namespaces do. As soon as I turn on the namespace, I get all the extension methods in the namespace. So my question boils down to the following: is there any value that I can get from extension methods found in a static class?
I understand that this is a compiler requirement for them to be placed in a static class, but it seems organizationally reasonable for it to be legal to allow extension methods to define in namespaces without classes surrounding them. To paraphrase the above question in another way: is there any practical benefit or help in any scenario that I get from the developer, if you have extension methods attached to the class or attached to the namespace?
Basically, I just want to get some kind of intuition, confirmation or understanding. I suspect that it was easiest to implement extension methods this way and did not cost time to allow extension methods to exist independently in namespaces.
source share