System.String.IsNullOrWhiteSpace Method

Indicates whether a specified string is null, empty, or consists only of white-space characters.

Syntax

public static bool IsNullOrWhiteSpace (string value)

Parameters

value
The string to test.

Returns

true if the value parameter is null or string.Empty, or if value consists exclusively of white-space characters.

Remarks

string.IsNullOrWhiteSpace(string) is a convenience method that is similar to the following code, except that it offers superior performance:

code reference: System.String.IsNullOrWhitespace#2

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

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0