Why is there no IsNullOrEmpty overload method without parameters?

c#

Solution

This method has been around long before extension methods were added to C#, and before extension methods, there was no way to define an instance method/property such as `xyz.IsNullOrEmpty()` that you could still call if `xyz` was `null`.

Problem

When trying to figure out if a string is null or empty, I usually have the string already. That's why I would have expected a utility function such as String.IsNullOrEmpty() to work without parameters: ``` String myString; bool test=myString.IsNullOrEmpty(); ``` However, this does not work, because IsNullOrEmpty expects a String parameter. Instead, I have to write: ``` String myString; bool test=String.IsNullOrEmpty(myString); ``` Why is this so? It seems unnecessarily clunky. Of course I can easily write own extension method for this, but it seems like a very obvious omission, so I am wondering if there is any good reason for this. I can't believe that the parameterless overload of this function has just been forgotten by Microsoft.

Original source