A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.boolean.tostring below:

Boolean.ToString Method (System) | Microsoft Learn

Boolean.ToString Method Definition

Converts the value of this instance to its equivalent string representation (either "True" or "False").

Overloads ToString(IFormatProvider)

Converts the value of this instance to its equivalent string representation (either "True" or "False").

ToString()

Converts the value of this instance to its equivalent string representation (either "True" or "False").

ToString(IFormatProvider)
Source:
Boolean.cs
Source:
Boolean.cs
Source:
Boolean.cs
Source:
Boolean.cs

Converts the value of this instance to its equivalent string representation (either "True" or "False").

public:
 virtual System::String ^ ToString(IFormatProvider ^ provider);
public string ToString(IFormatProvider? provider);
public string ToString(IFormatProvider provider);
override this.ToString : IFormatProvider -> string
Public Function ToString (provider As IFormatProvider) As String
Parameters Returns

TrueString if the value of this instance is true, or FalseString if the value of this instance is false.

Implements Remarks

The provider parameter is reserved. It does not participate in the execution of this method. This means that the Boolean.ToString(IFormatProvider) method, unlike most methods with a provider parameter, does not reflect culture-specific settings.

This method returns the constants "True" or "False". Note that XML is case-sensitive, and that the XML specification recognizes "true" and "false" as the valid set of Boolean values. If the String object returned by the ToString(IFormatProvider) method is to be written to an XML file, its String.ToLowerInvariant method should be called first to convert it to lowercase.

ToString()
Source:
Boolean.cs
Source:
Boolean.cs
Source:
Boolean.cs
Source:
Boolean.cs

Converts the value of this instance to its equivalent string representation (either "True" or "False").

public:
 override System::String ^ ToString();
public override string ToString();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Returns

"True" (the value of the TrueString property) if the value of this instance is true, or "False" (the value of the FalseString property) if the value of this instance is false.

Examples

The following example illustrates the ToString method.

bool raining = false;
bool busLate = true;

Console.WriteLine("raining.ToString() returns {0}", raining);
Console.WriteLine("busLate.ToString() returns {0}", busLate);
// The example displays the following output:
//       raining.ToString() returns False
//       busLate.ToString() returns True
let raining = false
let busLate = true

printfn $"raining.ToString() returns {raining}" 
printfn $"busLate.ToString() returns {busLate}"
// The example displays the following output:
//       raining.ToString() returns False
//       busLate.ToString() returns True
Dim raining As Boolean = False
Dim busLate As Boolean = True

Console.WriteLine("raining.ToString() returns {0}", raining)
Console.WriteLine("busLate.ToString() returns {0}", busLate)
' The example displays the following output:
'       raining.ToString() returns False
'       busLate.ToString() returns True
Remarks

This method returns the constants "True" or "False".

Note that XML is case-sensitive, and that the XML specification recognizes "true" and "false" as the valid set of Boolean values. If the string returned by the ToString() method is to be written to an XML file, its String.ToLowerInvariant method should be called first to convert it to lowercase.

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4