<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="11.0.0" />

System.Diagnostics.PerformanceData.CounterSet

public class CounterSet : IDisposable
Defines a set of logical counters.
public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)

Initializes a new instance of the CounterSet class.

public void AddCounter(int counterId, CounterType counterType)

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

public void AddCounter(int counterId, CounterType counterType, string counterName)

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

public CounterSetInstance CreateCounterSetInstance(string instanceName)

Creates an instance of the counter set.

public void Dispose()

Releases all unmanaged resources used by this object.

protected virtual void Dispose(bool disposing)

Releases all unmanaged resources used by this object and optionally release the managed resources.