LanguagePreferences.GetBooleanValue(RegistryKey, String, Boolean) 方法

定义

获取指定注册表项中的布尔值。

public:
 bool GetBooleanValue(Microsoft::Win32::RegistryKey ^ key, System::String ^ name, bool def);
public:
 bool GetBooleanValue(Microsoft::Win32::RegistryKey ^ key, Platform::String ^ name, bool def);
bool GetBooleanValue(Microsoft::Win32::RegistryKey const & key, std::wstring const & name, bool def);
public bool GetBooleanValue (Microsoft.Win32.RegistryKey key, string name, bool def);
member this.GetBooleanValue : Microsoft.Win32.RegistryKey * string * bool -> bool
Public Function GetBooleanValue (key As RegistryKey, name As String, def As Boolean) As Boolean

参数

key
RegistryKey

RegistryKey 对象,表示所需的注册表子项。

name
String

中要获取其值的注册表项的名称。

def
Boolean

中找不到注册表项时要使用的默认值。

返回

Boolean

rue 如果注册表项存在并且包含一个非零值,或者包含一个非零值或 "True" (不区分大小写的比较) ,则为; false 如果该注册表项存在并且包含零值或单词 "False" (不区分大小写的比较) 。 否则,将返回中指定的默认值 def 。 注意:如果注册表项是一个字符串,则除 "True" 或 "False" 之外的任何其他字符串都将引发 FormatException

注解

这是用于从注册表获取布尔值的帮助器方法。 它通常从方法中调用 InitMachinePreferences

适用于