PerformanceCounterCategory.CategoryHelp 속성

정의

범주의 도움말 텍스트를 가져옵니다.

public:
 property System::String ^ CategoryHelp { System::String ^ get(); };
public string CategoryHelp { get; }
member this.CategoryHelp : string
Public ReadOnly Property CategoryHelp As String

속성 값

이 범주가 측정하는 성능 개체에 대한 설명입니다.

예외

CategoryName 속성은 null입니다. 범주 도움말을 가져오기 전에 범주 이름을 설정해야 합니다.

내부 시스템 API를 호출하지 못한 경우

예제

다음 코드 예제에서는 를 사용하여 를 PerformanceCounterCategoryPerformanceCounterCategory()만듭니다. 사용자에게 PerformanceCounterCategory 및 컴퓨터 이름을 묻는 메시지를 표시한 다음 입력한 CategoryName 값에서 및 MachineName 속성을 설정합니다. 그런 다음 , MachineNameCategoryHelp 속성의 CategoryName값을 표시하거나 에 액세스할 수 없는 경우 PerformanceCounterCategory 오류 메시지를 표시합니다.

public static void Main(string[] args)
{
    string categoryName = "";
    string machineName = "";
    PerformanceCounterCategory pcc = new PerformanceCounterCategory();

    // Prompt for fields and set the corresponding properties.
    while (categoryName.Length==0)
    {
        Console.Write("Please enter a non-blank category name: ");
        categoryName = Console.ReadLine().Trim();
        if (categoryName.Length>0)
        {
            pcc.CategoryName = categoryName;
        }
    }
    while (machineName.Length==0)
    {
        Console.Write("Enter a non-blank computer name ['.' for local]: ");
        machineName = Console.ReadLine().Trim();
        if (machineName.Length>0)
        {
            pcc.MachineName = machineName;
        }
    }

    // Display the properties of the PerformanceCounterCategory object.
    try
    {
        Console.WriteLine("  Category:  {0}", pcc.CategoryName);
        Console.WriteLine("  Computer:  {0}", pcc.MachineName);
        Console.WriteLine("  Help text: {0}", pcc.CategoryHelp);
    }
    catch(Exception ex)
    {
        Console.WriteLine("Error getting the properties of the " +
            "PerformanceCounterCategory object:");
        Console.WriteLine(ex.Message);
    }
}
Sub Main(ByVal args() As String)
    Dim categoryName As String = ""
    Dim machineName As String = ""
    Dim pcc As New PerformanceCounterCategory

    ' Prompt for fields and set the corresponding properties.
    While categoryName.Length = 0
        Console.Write("Please enter a non-blank category name: ")
        categoryName = Console.ReadLine().Trim
        If categoryName.Length > 0 Then
            pcc.CategoryName = categoryName
        End If
    End While
    While machineName.Length = 0
        Console.Write( _
            "Enter a non-blank computer name ['.' for local]: ")
        machineName = Console.ReadLine().Trim
        If machineName.Length > 0 Then
            pcc.MachineName = machineName
        End If
    End While

    ' Display the properties of the PerformanceCounterCategory object.
    Try
        Console.WriteLine("  Category:  {0}", pcc.CategoryName)
        Console.WriteLine("  Computer:  {0}", pcc.MachineName)
        Console.WriteLine("  Help text: {0}", pcc.CategoryHelp)
    Catch ex As Exception
        Console.WriteLine("Error getting the properties of the " & _
            "PerformanceCounterCategory object:")
        Console.WriteLine(ex.Message)
    End Try
End Sub

적용 대상

추가 정보