PerformanceCounter.CounterName PerformanceCounter.CounterName PerformanceCounter.CounterName PerformanceCounter.CounterName Property

Definition

Gets or sets the name of the performance counter that is associated with this PerformanceCounter instance.

public:
 property System::String ^ CounterName { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.CounterNameConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.CounterNameConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.CounterNameConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.SettingsBindable(true)]
public string CounterName { get; set; }
member this.CounterName : string with get, set
Public Property CounterName As String

Property Value

The name of the counter, which generally describes the quantity being counted. This name is displayed in the list of counters of the Performance Counter Manager MMC snap in's Add Counters dialog box.

Exceptions

The platform is Windows 98 or Windows Millennium Edition (Me), which does not support performance counters.

Examples

The following code example shows how to set the CounterName property to a typical counter name.

PerformanceCounter^ PC = gcnew PerformanceCounter;
PC->CategoryName = "Process";
PC->CounterName = "Private Bytes";
PC->InstanceName = "Explorer";
MessageBox::Show( PC->NextValue().ToString() );
PerformanceCounter PC=new PerformanceCounter();
PC.CategoryName="Process";
PC.CounterName="Private Bytes";
PC.InstanceName="Explorer";
MessageBox.Show(PC.NextValue().ToString());
Dim PC As New PerformanceCounter()
PC.CategoryName = "Process"
PC.CounterName = "Private Bytes"
PC.InstanceName = "Explorer"
MessageBox.Show(PC.NextValue().ToString())

Remarks

You can get a list of available pre-existing counters from the Windows Performance Manager’s Add Counters dialog box.

Applies to