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.
Assembly: System (in System.dll)
Parameters
- instanceName
-
Type:
System::String^
The name of the instance to find in this collection.
| 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.
Available since 1.1