ExpandoObject.IDictionary<String,Object>.TryGetValue(String, Object) 方法

定义

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

 virtual bool System.Collections.Generic.IDictionary<string,object>.TryGetValue(System::String ^ key, [Runtime::InteropServices::Out] System::Object ^ % value) = System::Collections::Generic::IDictionary<System::String ^, System::Object ^>::TryGetValue;
bool IDictionary<string,object>.TryGetValue (string key, out object value);
Function TryGetValue (key As String, ByRef value As Object) As Boolean Implements IDictionary(Of String, Object).TryGetValue

参数

key
String

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

value
Object

当此方法返回时,如果找到该键,则包含与指定的键相关联的值;否则将包含 value 参数的类型默认值。When this method returns, contains the value associated with the specified key, if the key is found; otherwise, contains the default value for the type of the value parameter. 此参数未经初始化即被传递。This parameter is passed uninitialized.

返回

如果实现 true 的对象包含具有指定键的元素,则为 IDictionary<TKey,TValue>;否则为 falsetrue if the object that implements IDictionary<TKey,TValue> contains an element that has the specified key; otherwise, false.

适用于