Export (0) Print
Expand All

RouteValueDictionary.TryGetValue Method

Gets a value that indicates whether a value is associated with the specified key.

Namespace:  System.Web.Routing
Assembly:  System.Web (in System.Web.dll)

abstract TryGetValue : 
        key:string * 
        value:Object byref -> bool 
override TryGetValue : 
        key:string * 
        value:Object byref -> bool 

Parameters

key
Type: System.String
The key of the value to get.
value
Type: System.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.

Return Value

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

Implements

IDictionary(TKey, TValue).TryGetValue(TKey, TValue)

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 a null reference (Nothing in Visual Basic) for reference types.

.NET Framework

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2015 Microsoft