Being a C++ programmer, every time I work with C# I wonder why it lacks support for freestanding functions; in other words: functions that are not part of any class. I really miss this feature, because standalone functions allow to add functionality to classes without requiring full private access, avoiding hard-to-maintain monolith classes. Furthermore, it allows extending third party libraries. I know you can use a static class, but the class name is totally irrelevant, making the client code unnecessarily verbose.
For example. I want to create a helper function to count the words in a string. How can I avoid having to write "StringHelperClass.CountWords();" in the client code? StringHelperClass acts as a namespace, only I cannot write "using StringHelperClass;". I am forced to repeat "StringHelperClass" with every usage, whereas it is obvious that it is a string helper function, as its only parameter is a string.
Is there a way to extend a class' functionality, while keeping the client code concise?