Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Checks if the string is NULL or empty, then returns true, otherwise returns false.
- /// Example:
- /// if (someTextBox.Text.IsNullOrEmpty())
- /// {
- /// // handle as true (empty)...
- /// }
- /// else
- /// {
- /// // handle as false (not empty)...
- /// }
- /// </summary>
- /// <param name="inString"></param>
- /// <returns></returns>
- public static bool IsNullOrEmpty(this string inString)
- {
- if (inString == null)
- return true;
- else if (inString.Trim() == string.Empty)
- return true;
- else
- return false;
- }
- /// <summary>
- /// Determines whether string is not null or empty.
- /// </summary>
- /// <param name="input">The input.</param>
- /// <returns>
- /// <c>true</c> if [is not null or empty] [the specified input]; otherwise, <c>false</c>.
- /// </returns>
- public static bool IsNotNullOrEmpty(this string input)
- {
- return !String.IsNullOrEmpty(input);
- }
Advertisement
Add Comment
Please, Sign In to add comment