LoadTestUserContext.Add Method (String, Object)

Adds an element that has the provided key and value to the LoadTestUserContext.

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

Syntax

'Declaration
Public Sub Add ( _
    key As String, _
    value As Object _
)
public void Add(
    string key,
    Object value
)
public:
virtual void Add(
    String^ key, 
    Object^ value
) sealed
abstract Add : 
        key:string * 
        value:Object -> unit  
override Add : 
        key:string * 
        value:Object -> unit
public final function Add(
    key : String, 
    value : Object
)

Parameters

  • key
    Type: String

    The unique identifier to use as the key of the element to add.

  • value
    Type: Object

    The object to use as the value of the element to add.

Implements

IDictionary.Add(UTP, UTP)

Exceptions

Exception Condition
ArgumentNullException

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

ArgumentException

An element that has the same key already is located in the LoadTestUserContext.

NotSupportedException

The LoadTestUserContext is read-only.

Remarks

You can also use the Item property to add new elements by setting the value of a key that is not located in the LoadTestUserContext; for example, myLoadTestUserContext["myNonexistentKey"] = myValue. However, if the specified key already is located in the LoadTestUserContext, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.

key cannot be nulla null reference (Nothing in Visual Basic), but value can be nulla null reference (Nothing in Visual Basic) if value is a reference type.

.NET Framework Security

See Also

Reference

LoadTestUserContext Class

Add Overload

Microsoft.VisualStudio.TestTools.LoadTesting Namespace