PerformanceCounter class
Date: 07/09/06
(C Sharp) Keywords: no keywords
So here's a real C# question, since my last question, while admittedly not completely on-topic about C#, was deleted without explanation:
I am using the PerformanceCounter class and its related classes to iterate through the available performance categories, counters, and instances on a user's machine. Obviously these things (especially instances) tend to appear and disappear as the machine is used (e.g. processes tend to spawn and de-spawn).
My application is passively taking samples of some of the more interesting counters and storing them; at specified intervals it does some other things about which this post is not concerned.
Is there any way to tell if a performance counter that previously existed no longer exists (other than the obvious try/catch block on the NextSample() or NextValue() call)?
Thanks for any information
Source: http://community.livejournal.com/csharp/69019.html