![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Counters in C#
Counters in C# are performance counters that lets you know about your applications performance.
When you will build an application, whether it is a web app, mobile app or even desktop app, you would definitely need to monitor the performance.
For performance counters in C#, use the System.Diagnostics.PerformanceCounter class. Set the instance of the PerformanceCounter class and work with the following properties: CategoryName, CounterName, MachineName and ReadOnly.
To get the performance categories.
var counter = PerformanceCounterCategory.GetCategories();
Now SET performance counters for the category processor.
var counter = PerformanceCounterCategory.GetCategories() .FirstOrDefault(category => category.CategoryName == "Processor");
Advertisements