Share via


PerformanceCounterCategory.CategoryHelp Propiedad

Definición

Obtiene el texto de ayuda de la categoría.

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

Valor de propiedad

Descripción del objeto de rendimiento que esta categoría mide.

Excepciones

La propiedad CategoryName es null. Es necesario establecer el nombre de la categoría antes de obtener la ayuda de la categoría.

Se ha producido un error en la llamada a una API del sistema subyacente.

Ejemplos

En el PerformanceCounterCategory()ejemplo de código siguiente se crea con PerformanceCounterCategory . Solicita al usuario los nombres de PerformanceCounterCategory equipo y y, a continuación, establece las CategoryName propiedades y MachineName de los valores especificados. A continuación, muestra los valores de las CategoryNamepropiedades , MachineNamey CategoryHelp , o muestra un mensaje de error si PerformanceCounterCategory no se puede tener acceso a .

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

Se aplica a

Consulte también