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.

PerformanceCounter.RemoveInstance Method

Deletes the category instance specified by the PerformanceCounter object InstanceName property.

[Visual Basic]
Public Sub RemoveInstance()
[C#]
public void RemoveInstance();
[C++]
public: void RemoveInstance();
[JScript]
public function RemoveInstance();

Exceptions

Exception Type Condition
InvalidOperationException This counter is read-only, so any instance that is associated with the category cannot be removed.

-or-

The instance is not correctly associated with a performance counter.

Win32Exception An error occurred when accessing a system API.

Remarks

You can remove an instance only for a custom counter. All system counters are read-only, so attempting to remove one of them throws an exception.

To create a performance category instance, specify an instanceName on the PerformanceCounter constructor. If the category instance specified by instanceName already exists the new object will reference the existing category instance.

Requirements

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

PerformanceCounter Class | PerformanceCounter Members | System.Diagnostics Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft