Everyone knows and love String.IsNullOrEmpty(yourString) method.
I was wondering if it\'s going to confuse developers or make code better if we extend String class t
Let's look at the pro:s and con:s...
- More readable.
Yes, slightly, but the improvement in readability is outweighed by the fact that it looks like you are calling an instance method on something that doesn't have to be an instance. In effect it's easier to read, but it's harder to understand, so the improved readability is really just an illusion.
- Less typing.
Yes, but that is really not a strong argument. If typing is the main part of your programming, you are just not doing something that is remotely challenging enough for you to evolve as a developer.
- Can be confusing because yourString variable can be null and it looks like you're executing method on a null variable.
True, (as mentioned above).