CounterSet.AddCounter Method

Definition

Adds a counter to the counter set.

Overloads

AddCounter(Int32, CounterType)

Adds a counter to the counter set by using the specified counter identifier and type.

AddCounter(Int32, CounterType, String)

Adds a counter to the counter set by using the specified counter identifier and type and a display name for the counter.

AddCounter(Int32, CounterType)

Source:
CounterSet.cs
Source:
CounterSet.cs
Source:
CounterSet.cs

Adds a counter to the counter set by using the specified counter identifier and type.

public:
 void AddCounter(int counterId, System::Diagnostics::PerformanceData::CounterType counterType);
public void AddCounter (int counterId, System.Diagnostics.PerformanceData.CounterType counterType);
member this.AddCounter : int * System.Diagnostics.PerformanceData.CounterType -> unit
Public Sub AddCounter (counterId As Integer, counterType As CounterType)

Parameters

counterId
Int32

Identifies the counter. Use the same value that you used in the manifest to define the counter.

counterType
CounterType

Identifies the counter type. The counter type determines how the counter data is calculated, averaged, and displayed.

Exceptions

The counter identifier already exists in the set or is negative, or the counter type is NULL or not valid.

You cannot add counters to the counter set after creating an instance of the counter set.

Remarks

You must add counters to the counter set before creating an instance of the counter set.

Applies to

AddCounter(Int32, CounterType, String)

Source:
CounterSet.cs
Source:
CounterSet.cs
Source:
CounterSet.cs

Adds a counter to the counter set by using the specified counter identifier and type and a display name for the counter.

public:
 void AddCounter(int counterId, System::Diagnostics::PerformanceData::CounterType counterType, System::String ^ counterName);
public void AddCounter (int counterId, System.Diagnostics.PerformanceData.CounterType counterType, string counterName);
member this.AddCounter : int * System.Diagnostics.PerformanceData.CounterType * string -> unit
Public Sub AddCounter (counterId As Integer, counterType As CounterType, counterName As String)

Parameters

counterId
Int32

Identifies the counter. Use the same value that you used in the manifest to define the counter.

counterType
CounterType

Identifies the counter type. The counter type determines how the counter data is calculated, averaged, and displayed.

counterName
String

Name of the counter. You can use this name to index the counter in the counter set instance. (See Item[String].)

Exceptions

The counter identifier already exists in the set or is negative, or the counter type is NULL or not valid.

You cannot add counters to the counter set after creating an instance of the counter set.

Examples

For an example, see System.Diagnostics.PerformanceData.

Remarks

You must add counters to the counter set before creating an instance of the counter set.

Applies to