PerformanceCounter.CounterName Proprietà

Definizione

Ottiene o imposta il nome del contatore delle prestazioni associato a questa istanza di PerformanceCounter.

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

Valore della proprietà

String

Il nome del contatore, che in genere descrive la quantità rilevata. Questo nome viene visualizzato nell'elenco dei contatori della finestra di dialogo Aggiungi contatori dello snap-in MMC di gestione del contatore delle prestazioni.

Attributi

Eccezioni

L'elemento CounterName è null.

Esempio

Nell'esempio di codice seguente viene illustrato come impostare la CounterName proprietà su un nome di contatore tipico.

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())

Commenti

È possibile ottenere un elenco di contatori preesistenti disponibili dalla finestra di dialogo Aggiungi contatori di Windows Performance Manager.

Si applica a