NameScope.TryGetValue(String, Object) 方法

定义

获取与指定的键关联的值。Gets the value associated with the specified key.

public:
 virtual bool TryGetValue(System::String ^ key, [Runtime::InteropServices::Out] System::Object ^ % value);
public bool TryGetValue (string key, out object value);
abstract member TryGetValue : string * obj -> bool
override this.TryGetValue : string * obj -> bool
Public Function TryGetValue (key As String, ByRef value As Object) As Boolean

参数

key
String

要获取的值的键。The key of the value to get.

value
Object

当此方法返回时,如果找到指定的键,则其中包含与该键关联的值;否则为 null 对象。When this method returns, contains the value associated with the specified key, if the key is found; otherwise, a null object. 此参数在传递时尚未初始化。This parameter is passed uninitialized.

返回

Boolean

如果 NameScope 包含以 key 形式提供的名称的映射,则为 truetrue if the NameScope contains a mapping for the name provided as key. 否则为 falseOtherwise, false.

适用于