RouteValueDictionary.TryGetValue(String, Object) Method

Definition

Gets a value that indicates whether a value is 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

Parameters

key
String

The key of the value to get.

value
Object

When this method returns, contains the value that is associated with the specified key, if the key is found; otherwise, contains the appropriate default value for the type of the value parameter that you provided as an out parameter. This parameter is passed uninitialized.

Returns

true if the dictionary contains an element that has the specified key; otherwise, false.

Remarks

This method combines the functionality of the ContainsKey method and the Item[] property.

If the key is not found, the value parameter is assigned the appropriate default value for the type, such as 0 (zero) for integer types, false for Boolean types, and null for reference types.

Applies to

See also