String.IsNullOrWhiteSpace Method

Indicates whether a specified string is a null reference (Nothing in Visual Basic), empty, or consists only of white-space characters.

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

static member IsNullOrWhiteSpace : 
        value:string -> bool

Parameters

value
Type: System.String

The string to test.

Return Value

Type: System.Boolean
true if the value parameter is a null reference (Nothing in Visual Basic) or String.Empty, or if value consists exclusively of white-space characters.

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

No code example is currently available or this language may not be supported.

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.

The following example creates a string array, and then passes each element of the array to the IsNullOrWhiteSpace method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft