ToString Method (Boolean)

Convert.ToString Method (Boolean)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Converts the value of the specified Boolean to its equivalent String representation.

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

'Declaration
Public Shared Function ToString ( _
	value As Boolean _
) As String

Parameters

value
Type: System.Boolean
A Boolean value.

Return Value

Type: System.String
The String equivalent of the value of value.

This implementation is identical to Boolean.ToString. It returns Boolean.TrueString for true values and Boolean.FalseString for false values.

The following example illustrates the conversion of a Boolean to a String, using ToString. It also illustrates that the string returned by the conversion equals either Boolean.TrueString or Boolean.FalseString.


Dim falseFlag As Boolean = False
Dim trueFlag As Boolean = True

outputBlock.Text += Convert.ToString(falseFlag) & vbCrLf
outputBlock.Text += Convert.ToString(falseFlag).Equals(Boolean.FalseString) & vbCrLf
outputBlock.Text += Convert.ToString(trueFlag) & vbCrLf
outputBlock.Text += Convert.ToString(trueFlag).Equals(Boolean.TrueString) & vbCrLf
' The example displays the following output:
'       False
'       True
'       True
'       True      


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft