PerformanceCounterCategoryType in .NET 2.0

F

Frank Rizzo

I am porting an app from net 1.1 to .net 2.0. I have a line of code
(which sets up Performance Counters) that the new framework has obsoleted:

CounterCreationDataCollection CCDC = new CounterCreationDataCollection();

// obsoleted line
PerformanceCounterCategory pcc = PerformanceCounterCategory.Create("My
Category", "My Category Description", CCDC);

The preferred line is now:

pcc = PerformanceCounterCategory.Create("My Category", "My Category
Description",
PerformanceCounterCategoryType.SingleInstance, CCDC);

The difference obviously is the PerformanceCounterCategoryType enum
which supports SingleInstance and MultiInstance. From the sparse
documentation, I am not quite grokking the difference between the 2. I
want my code to work as it did under 1.1 framework. Which enumeration
value should I use?

Thanks.
 
K

Kevin Yu [MSFT]

Hi Frank,

PerformanceCounterCategoryType enum indicates whether the performance
counter can have multiple instances. If you're only creating 1 instance in
your app, like in .NET 1.1, just use
PerformanceCounterCategoryType.SingleInstance. If you're trying to create
multiple instances for this category, please use
PerformanceCounterCategoryType.MultiInstance.

If anything is unclear, please feel free to let me know.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Hi Frank,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
F

Frank Rizzo

Kevin said:
Hi Frank,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

It seems to work fine, just like it did in .net 1.1, which is what I
wanted. Thank you. If any issues come up, I'll post them in a new thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top