String.IsNullOrBlank Extension Method
I continuously check string fields to check if they are null or blank. if(myString == null || myString.Trim().Length == 0) { throw new ArgumentException("Blank strings cannot be handled."); } To save myself a bit of typing is it possible to create an extension method for the String class that would have the same effect? I understand how extension methods can be added for a class instance but what about adding a static extension method to a class? if(String.IsNullOrBlank(myString)) { throw new ArgumentException("Blank strings cannot be handled."); } Sean You could do: public static bool