Extension method to test whether a string is null or empty or whitespace

/ Published in: C#
Save to your folder(s)

Copy this code and paste it in your HTML
  1. public static bool IsNullOrEmpty(this string input)
  2. {
  3. if (string.IsNullOrEmpty(input))
  4. return true;
  6. return string.IsNullOrEmpty(input.Trim());
  7. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.