次の方法で共有


CounterCreationData.CounterHelp プロパティ

カスタム カウンタの説明を取得または設定します。

Public Property CounterHelp As String
[C#]
public string CounterHelp {get; set;}
[C++]
public: __property String* get_CounterHelp();public: __property void set_CounterHelp(String*);
[JScript]
public function get CounterHelp() : String;public function set CounterHelp(String);

プロパティ値

カウンタの動作を説明するテキスト。

使用例

 
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

[C#] 
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);
         }
      }
   }
}

[C++] 
#using <mscorlib.dll>
#using <System.dll>

using namespace System;
using namespace System::Diagnostics;

int main() {
    CounterCreationDataCollection* myCol = new CounterCreationDataCollection();

    // Create two custom counter objects.
    CounterCreationData* myCounter1 = new CounterCreationData(S"Counter1",
        S"First custom counter", PerformanceCounterType::CounterDelta32);

    CounterCreationData* myCounter2 = new CounterCreationData();

    // Set the properties of the 'CounterCreationData' Object*.
    myCounter2->CounterName = S"Counter2";
    myCounter2->CounterHelp = S"Second custom counter";
    myCounter2->CounterType = PerformanceCounterType::NumberOfItemsHEX32;

    // Add custom counter objects to CounterCreationDataCollection.
    myCol->Add(myCounter1);
    myCol->Add(myCounter2);

    if (PerformanceCounterCategory::Exists(S"New Counter Category"))
        PerformanceCounterCategory::Delete(S"New Counter Category");

    // Bind the counters to a PerformanceCounterCategory.
    PerformanceCounterCategory* myCategory =
        PerformanceCounterCategory::Create(S"New Counter Category", S"Category Help", myCol);

    Console::WriteLine(S"Counter Information:");
    Console::WriteLine(S"Category Name: {0}", myCategory->CategoryName);
    for (int i = 0; i < myCol->Count; i++) {
        // Display the properties of the CounterCreationData objects.
        Console::WriteLine(S"CounterName : {0}", myCol->Item[i]->CounterName);
        Console::WriteLine(S"CounterHelp : {0}", myCol->Item[i]->CounterHelp);
        Console::WriteLine(S"CounterType : {0}", __box(myCol->Item[i]->CounterType));
    }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

CounterCreationData クラス | CounterCreationData メンバ | System.Diagnostics 名前空間 | CounterType | CounterName | CounterCreationData