System::Boolean::TryParse 方法

Boolean::TryParse method

将指定的字符串转换为 bool 类型的值。

static bool System::Boolean::TryParse(const String &value, bool &result)
参数类型描述
const String&待转换的字符串。
resultbool&用于存放转换结果的 bool 变量的引用;如果指定的字符串等于 “True”,则结果为 true;如果等于 “False”,则结果为 false。

ReturnValue

如果指定的字符串等于 “True” 或 “False”,则为 true,否则为 false。

另见