Extension methods are interesting

Not my idea, but it amused me. Thanks Dave.

namespace ExtensionMethodsAreEvil
 class ExtensionMethodsAreEvil
 public static void Main()
 string myNullString = null;
 Console.WriteLine("Is the string empty? " + myNullString.IsNullOrEmpty());

 public static class ExtendString
 public static bool IsNullOrEmpty(this string s)
 return string.IsNullOrEmpty(s);

4 thoughts on “Extension methods are interesting”

  1. I’m missing the point, sorry Dave :-)!

    I would also add that it is a very border line usage in my opinion, because it’s changing an important behaviour of the framework, that is throwing exceptions when calling a method on a null object.
    When you start changing basic behaviours such as these, god knows where you’ll end up 🙂

  2. Sorry I should have put “interesting”; i.e., horrible! This is completely wrong, wrong, wrong. But it works as comedy, I think.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s