Windows apps
Collapse the table of content
Expand the table of content
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.

InstanceDataCollection::Contains Method (String^)

 

Determines whether a performance instance with a specified name (identified by one of the indexed InstanceData objects) exists in the collection.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

public:
bool Contains(
	String^ instanceName
)

Parameters

instanceName
Type: System::String^

The name of the instance to find in this collection.

Return Value

Type: System::Boolean

true if the instance exists in the collection; otherwise, false.

Exception Condition
ArgumentNullException

The instanceName parameter is null.

The instanceName parameter is case-insensitive.

The following code example accepts a PerformanceCounter category name, counter name, and instance name from the command line. It gets the InstanceDataCollectionCollection for the category, which is a collection of InstanceDataCollection objects. From that it gets the particular InstanceDataCollection for the specified counter. It then uses the Contains method to determine if the specified instance exists, using the default single-instance name if none is entered.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft