C# Boolean ToString(IFormatProvider)
Description
Boolean ToString(IFormatProvider)
converts the value
of this instance to its equivalent string representation (either "True"
or "False").
Syntax
Boolean.ToString(IFormatProvider)
has the following syntax.
public string ToString(
IFormatProvider provider
)
Parameters
Boolean.ToString(IFormatProvider)
has the following parameters.
provider
- (Reserved) An IFormatProvider object.
Returns
Boolean.ToString(IFormatProvider)
method returns TrueString if the value of this instance is true, or FalseString if the value
of this instance is false.
Example
Converts the value of this instance to its equivalent string representation (either "True" or "False").
using System;//from w w w. ja v a 2 s.co m
using System.Globalization;
public class MainClass {
public static void Main(String[] argv){
bool raining = false;
bool busLate = true;
Console.WriteLine("raining.ToString() returns {0}", raining.ToString(CultureInfo.InvariantCulture));
Console.WriteLine("busLate.ToString() returns {0}", busLate.ToString(CultureInfo.CreateSpecificCulture("en-GB")));
}
}
The code above generates the following result.