bool value to string
In this chapter you will learn:
Using ToString() to Convert to a string
class MainClass/* j a v a2 s. c o m*/
{
static void Main()
{
bool boolean = true;
string text = boolean.ToString();
// Display "True"
System.Console.WriteLine(text);
}
}
Convert boolean value to "Yes" or "No"
using System;/*from ja v a 2 s. com*/
public class Main
{
public static string ConvertBoolToYesNo(bool b)
{
if (b) { return "Yes"; }
return "No";
}
}
Next chapter...
What you will learn in the next chapter: