C#中的Boolean.ToString()方法
C#中的Boolean.ToString()方法将此实例的值转换为其等效的字符串表示形式(“True”或“False”)。
语法
以下是语法-
public override string ToString ();
示例
现在让我们看一个实现Boolean.ToString()方法的示例-
using System;
public class Demo {
public static void Main(){
bool b = true;
string res = b.ToString();
Console.WriteLine("Return Value = "+res);
}
}输出结果
这将产生以下输出-
Return Value = True
示例
现在让我们来看另一个实现Boolean.ToString()方法的示例-
using System;
public class Demo {
public static void Main(){
bool b = false;
string res = b.ToString();
Console.WriteLine("Return Value = "+res);
}
}输出结果
这将产生以下输出-
Return Value = False
热门推荐
10 病人祝福语老师寄语简短
11 新娘生孩子祝福语简短
12 婆婆66岁祝福语简短
13 今天孩子高考祝福语简短
14 送彩票生日祝福语简短
15 分别祝福语简短情话英文
16 画室揭牌仪式祝福语简短
17 女友妈妈生日祝福语简短
18 离别赠言离职祝福语简短