Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Handy Extension Methods

, 3 Jun 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
public static bool IsNullEmptyOrWhitespace(this string value){ return string.IsNullOrEmpty(value) || string.IsNullOrEmpty(value.Trim());}In C# 4.0, you already have such a function.string.IsNullOrWhiteSpace(value)
public static bool IsNullEmptyOrWhitespace(this string value)
{
        return string.IsNullOrEmpty(value) || string.IsNullOrEmpty(value.Trim());
}
 
In C# 4.0, you already have such a function.
 
string.IsNullOrWhiteSpace(value)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Anshul R
Student
India India
No Biography provided

Comments and Discussions

 
GeneralCalling value.Trim creates a new copy of the string. Why not... PinmemberRichard Deeming8-Jun-11 7:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150302.1 | Last Updated 3 Jun 2011
Article Copyright 2011 by Anshul R
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid