System::Boolean 类

Boolean class

保存 System.Boolean .Net 类型静态成员的类。

class Boolean

方法

方法描述
static Parse(const String&)将指定的字符串转换为 bool 类型的值。
static TryParse(const String&, bool&)将指定的字符串转换为 bool 类型的值。

字段

字段描述
static FalseStringString 表示的 ‘false’ 布尔值。
static TrueStringString 表示的 ’true’ 布尔值。

备注

#include <system/boolean.h>

using namespace System;

int main()
{
  // 创建布尔变量。
  bool isWeekend = false;

  // 解析输入字符串并打印结果。
  if (Boolean::TryParse(u"True", isWeekend))
  {
    std::cout << "Is weekend: " << (isWeekend ? "Yes" : "No");
  }
  else
  {
    std::cerr << "Something went wrong" << std::endl;
  }

  return 0;
}
/*
This code example produces the following output:
Is weekend: Yes
*/

另见