Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

LoadTestContext::Add Method (String^, Object^)

 

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

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

public:
virtual void Add(
	String^ key,
	Object^ value
) sealed

Parameters

key
Type: System::String^

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

value
Type: System::Object^

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

Exception Condition
ArgumentNullException

key is null.

ArgumentException

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

NotSupportedException

The LoadTestContext is read-only.

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

key cannot be null, but value can be null if value is a reference type.

Return to top
Show: