Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft den Leistungsindikatortyp des benutzerdefinierten Zählers ab oder legt diesen fest.
Namespace: System.Diagnostics
Assembly: System (in system.dll)
Syntax
'Declaration
Public Property CounterType As PerformanceCounterType
'Usage
Dim instance As CounterCreationData
Dim value As PerformanceCounterType
value = instance.CounterType
instance.CounterType = value
public PerformanceCounterType CounterType { get; set; }
public:
property PerformanceCounterType CounterType {
PerformanceCounterType get ();
void set (PerformanceCounterType value);
}
/** @property */
public PerformanceCounterType get_CounterType ()
/** @property */
public void set_CounterType (PerformanceCounterType value)
public function get CounterType () : PerformanceCounterType
public function set CounterType (value : PerformanceCounterType)
Eigenschaftenwert
Ein PerformanceCounterType, der das Verhalten des Leistungsindikators definiert.
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Sie haben einen Typ angegeben, der kein Member der PerformanceCounterType-Enumeration ist. |
Beispiel
Imports System
Imports System.Diagnostics
Namespace MyDiagnostics
Class MyCounterCreationData
Shared Sub Main()
Dim myCol As New CounterCreationDataCollection()
' Create two custom counter objects.
Dim myCounter1 As New CounterCreationData("Counter1", "First custom counter", _
PerformanceCounterType.CounterDelta32)
Dim myCounter2 As 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.
myCol.Add(myCounter1)
myCol.Add(myCounter2)
If PerformanceCounterCategory.Exists("New Counter Category") Then
PerformanceCounterCategory.Delete("New Counter Category")
End If
' Bind the counters to a PerformanceCounterCategory.
Dim myCategory As PerformanceCounterCategory = PerformanceCounterCategory.Create("New " + _
"Counter Category", "Category Help", myCol)
Console.WriteLine("Counter Information:")
Console.WriteLine("Category Name: " + myCategory.CategoryName)
Dim i As Integer
For i = 0 To myCol.Count - 1
' 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.ToString())
Next i
End Sub 'Main
End Class 'MyCounterCreationData
End Namespace 'MyDiagnostics
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.
myCol.Add(myCounter1);
myCol.Add(myCounter2);
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", 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);
}
}
}
}
#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
int main()
{
CounterCreationDataCollection^ myCol = gcnew CounterCreationDataCollection;
// Create two custom counter objects.
CounterCreationData^ myCounter1 = gcnew CounterCreationData( "Counter1","First custom counter",PerformanceCounterType::CounterDelta32 );
CounterCreationData^ myCounter2 = gcnew 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.
myCol->Add( myCounter1 );
myCol->Add( myCounter2 );
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", myCol );
Console::WriteLine( "Counter Information:" );
Console::WriteLine( "Category Name: {0}", myCategory->CategoryName );
for ( int i = 0; i < myCol->Count; i++ )
{
// Display the properties of the CounterCreationData objects.
Console::WriteLine( "CounterName : {0}", myCol[ i ]->CounterName );
Console::WriteLine( "CounterHelp : {0}", myCol[ i ]->CounterHelp );
Console::WriteLine( "CounterType : {0}", myCol[ i ]->CounterType );
}
}
import System.*;
import System.Diagnostics.*;
class MyCounterCreationData
{
public static void main(String[] args)
{
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.set_CounterName("Counter2");
myCounter2.set_CounterHelp("Second custom counter");
myCounter2.set_CounterType(PerformanceCounterType.NumberOfItemsHEX32);
// Add custom counter objects to CounterCreationDataCollection.
myCol.Add(myCounter1);
myCol.Add(myCounter2);
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", myCol);
Console.WriteLine("Counter Information:");
Console.WriteLine("Category Name: " + myCategory.get_CategoryName());
for (int i = 0; i < myCol.get_Count(); i++) {
// Display the properties of the CounterCreationData objects.
Console.WriteLine("CounterName : "
+ myCol.get_Item(i).get_CounterName());
Console.WriteLine("CounterHelp : "
+ myCol.get_Item(i).get_CounterHelp());
Console.WriteLine("CounterType : "
+ myCol.get_Item(i).get_CounterType());
}
} //main
} //MyCounterCreationData
Plattformen
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
CounterCreationData-Klasse
CounterCreationData-Member
System.Diagnostics-Namespace
CounterCreationData.CounterName-Eigenschaft
CounterCreationData.CounterHelp-Eigenschaft
CounterCreationData