다음을 통해 공유


LoadTestUserContext.TryGetValue Method

Gets the value that is associated with the specified key.

Namespace:  Microsoft.VisualStudio.TestTools.LoadTesting
Assembly:  Microsoft.VisualStudio.QualityTools.LoadTestFramework (in Microsoft.VisualStudio.QualityTools.LoadTestFramework.dll)

Syntax

'Declaration
Public Function TryGetValue ( _
    key As String, _
    <OutAttribute> ByRef value As Object _
) As Boolean
public bool TryGetValue(
    string key,
    out Object value
)
public:
virtual bool TryGetValue(
    String^ key, 
    [OutAttribute] Object^% value
) sealed
abstract TryGetValue : 
        key:string * 
        value:Object byref -> bool  
override TryGetValue : 
        key:string * 
        value:Object byref -> bool
public final function TryGetValue(
    key : String, 
    value : Object
) : boolean

Parameters

  • key
    Type: String

    The key to find.

  • value
    Type: Object%

    The referenced object that obtains the value of the key, if it is found; otherwise, it obtains the default value for the type of the value parameter. This parameter can be passed uninitialized.

Return Value

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

Implements

IDictionary.TryGetValue(UTP, UTP)

Exceptions

Exception Condition
ArgumentNullException

key is nulla null reference (Nothing in Visual Basic).

Remarks

This is the most efficient way to try to obtain values if many tried keys are not in the dictionary. This method combines the functionality of the ContainsKey method and the Item property.

If the key is not found, the outvalue parameter gets the appropriate default value: zero for integer types, false for Boolean types, and nulla null reference (Nothing in Visual Basic) for reference types.

.NET Framework Security

See Also

Reference

LoadTestUserContext Class

Microsoft.VisualStudio.TestTools.LoadTesting Namespace