Thursday, 8 July 2010

EXTENSION METHOD TO TEST WHETHER A STRING IS NULL OR EMPTY OR WHITESPACE

  1. public static bool IsNullOrEmpty(this string input)
  2. {
  3. if (string.IsNullOrEmpty(input))
  4. return true;
  5. return string.IsNullOrEmpty(input.Trim());
  6. }

No comments:

Post a Comment