This documentation is archived and is not being maintained.

CounterCreationData.CounterHelp Property

Gets or sets the custom counter's description.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

public string CounterHelp { get; set; }

Property Value

Type: System.String
The text that describes the counter's behavior.


The specified value is null.

The following code example demonstrates how to get and set the CounterHelp property. This example creates two counters and sets their CounterHelp property by using different techniques. When the first counter is initialized, the CounterHelp data is passed to the constructor, whereas the second counter sets the property explicitly.

using System;
using System.Diagnostics;

namespace MyDiagnostics
    class MyCounterCreationData
        static void Main()
            CounterCreationDataCollection myCol =
                                       new CounterCreationDataCollection();

            // Create two custom counter objects.
            CounterCreationData myCounter1 = new CounterCreationData("Counter1",
               "First custom counter", PerformanceCounterType.CounterDelta32);

            CounterCreationData myCounter2 = new CounterCreationData();

            // Set the properties of the 'CounterCreationData' object.
            myCounter2.CounterName = "Counter2";
            myCounter2.CounterHelp = "Second custom counter";
            myCounter2.CounterType = PerformanceCounterType.NumberOfItemsHEX32;

            // Add custom counter objects to CounterCreationDataCollection.

            if (PerformanceCounterCategory.Exists("New Counter Category"))
                PerformanceCounterCategory.Delete("New Counter Category");

            // Bind the counters to a PerformanceCounterCategory.
            PerformanceCounterCategory myCategory =
                  PerformanceCounterCategory.Create("New Counter Category", "Category Help",
                PerformanceCounterCategoryType.SingleInstance, myCol);

            Console.WriteLine("Counter Information:");
            Console.WriteLine("Category Name: " + myCategory.CategoryName);
            for (int i = 0; i < myCol.Count; i++)
                // Display the properties of the CounterCreationData objects.
                Console.WriteLine("CounterName : " + myCol[i].CounterName);
                Console.WriteLine("CounterHelp : " + myCol[i].CounterHelp);
                Console.WriteLine("CounterType : " + myCol[i].CounterType);

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.