Extension methods are interesting

May 15, 2008

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);
 }
 }
}


Follow

Get every new post delivered to your Inbox.