C# String.isnullorempty Vs String.isnullorwhitespace Code Example


Example: string isnullorempty vs isnullorwhitespace


/* IsNullOrWhiteSpace is a convenience method that is similar to 
the following code, except that it offers superior performance: */


return String.IsNullOrEmpty(value) || value.Trim().Length == 0;

/* White-space characters are defined by the Unicode standard.
The IsNullOrWhiteSpace method interprets any character that returns
a value of true when it is passed to the Char.IsWhiteSpace method as
a white-space character. */

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable