Language

PerformanceCounterCategory コンストラクター

定義

PerformanceCounterCategory クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
PerformanceCounterCategory()

PerformanceCounterCategory クラスの新しいインスタンスを初期化し、CategoryName プロパティを空のままにして、MachineName プロパティをローカル コンピューターに設定します。

PerformanceCounterCategory(String)

PerformanceCounterCategory クラスの新しいインスタンスを初期化し、CategoryName プロパティを指定した値に設定し、MachineName プロパティをローカル コンピューターに設定します。

PerformanceCounterCategory(String, String)

PerformanceCounterCategory クラスの新しいインスタンスを初期化し、CategoryName プロパティと MachineName プロパティを指定した値に設定します。

PerformanceCounterCategory()

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

PerformanceCounterCategory クラスの新しいインスタンスを初期化し、CategoryName プロパティを空のままにして、MachineName プロパティをローカル コンピューターに設定します。

public:
 PerformanceCounterCategory();
public PerformanceCounterCategory();
Public Sub New ()

例

次のコード例では、コマンド ラインから PerformanceCounterCategory 名とコンピューター名を受け取ります。 指定されたパラメーターの数に適したコンストラクター オーバーロードを使用して PerformanceCounterCategory を作成し、そのプロパティを表示します。

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

    // Copy the supplied arguments into the local variables.
    try
    {
        categoryName = args[0];
        machineName = args[1]=="."? "": args[1];
    }
    catch(Exception ex)
    {
        // Ignore the exception from non-supplied arguments.
    }

    // Create a PerformanceCounterCategory object using
    // the appropriate constructor.
    if (categoryName.Length==0)
    {
        pcc = new PerformanceCounterCategory();
    }
    else if(machineName.Length==0)
    {
        pcc = new PerformanceCounterCategory(categoryName);
    }
    else
    {
        pcc = new PerformanceCounterCategory(categoryName, 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 PerformanceCounterCategory

    ' Copy the supplied arguments into the local variables.
    Try
        categoryName = args(0)
        machineName = IIf(args(1) = ".", "", args(1))
    Catch ex As Exception
        ' Ignore the exception from non-supplied arguments.
    End Try

    ' Create a PerformanceCounterCategory object using 
    ' the appropriate constructor.
    If categoryName.Length = 0 Then
        pcc = New PerformanceCounterCategory
    ElseIf machineName.Length = 0 Then
        pcc = New PerformanceCounterCategory(categoryName)
    Else
        pcc = New PerformanceCounterCategory(categoryName, machineName)
    End If

    ' 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

注釈

この CategoryName インスタンスをサーバー上のパフォーマンス オブジェクトに関連付ける前に、PerformanceCounterCategory プロパティを設定する必要があります。 それ以外の場合は、例外がスローされます。

こちらもご覧ください

適用対象

PerformanceCounterCategory(String)

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

PerformanceCounterCategory クラスの新しいインスタンスを初期化し、CategoryName プロパティを指定した値に設定し、MachineName プロパティをローカル コンピューターに設定します。

public:
 PerformanceCounterCategory(System::String ^ categoryName);
public PerformanceCounterCategory(string categoryName);
new System.Diagnostics.PerformanceCounterCategory : string -> System.Diagnostics.PerformanceCounterCategory
Public Sub New (categoryName As String)

パラメーター

categoryName
String

この PerformanceCounterCategory インスタンスを関連付けるパフォーマンス カウンター カテゴリまたはパフォーマンス オブジェクトの名前。

例外

categoryNameは空の文字列 ("") です。

categoryName は null です。

例

次のコード例では、コマンド ラインから PerformanceCounterCategory 名とコンピューター名を受け取ります。 指定されたパラメーターの数に適したコンストラクター オーバーロードを使用して PerformanceCounterCategory を作成し、そのプロパティを表示します。

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

    // Copy the supplied arguments into the local variables.
    try
    {
        categoryName = args[0];
        machineName = args[1]=="."? "": args[1];
    }
    catch(Exception ex)
    {
        // Ignore the exception from non-supplied arguments.
    }

    // Create a PerformanceCounterCategory object using
    // the appropriate constructor.
    if (categoryName.Length==0)
    {
        pcc = new PerformanceCounterCategory();
    }
    else if(machineName.Length==0)
    {
        pcc = new PerformanceCounterCategory(categoryName);
    }
    else
    {
        pcc = new PerformanceCounterCategory(categoryName, 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 PerformanceCounterCategory

    ' Copy the supplied arguments into the local variables.
    Try
        categoryName = args(0)
        machineName = IIf(args(1) = ".", "", args(1))
    Catch ex As Exception
        ' Ignore the exception from non-supplied arguments.
    End Try

    ' Create a PerformanceCounterCategory object using 
    ' the appropriate constructor.
    If categoryName.Length = 0 Then
        pcc = New PerformanceCounterCategory
    ElseIf machineName.Length = 0 Then
        pcc = New PerformanceCounterCategory(categoryName)
    Else
        pcc = New PerformanceCounterCategory(categoryName, machineName)
    End If

    ' 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

こちらもご覧ください

適用対象

PerformanceCounterCategory(String, String)

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

PerformanceCounterCategory クラスの新しいインスタンスを初期化し、CategoryName プロパティと MachineName プロパティを指定した値に設定します。

public:
 PerformanceCounterCategory(System::String ^ categoryName, System::String ^ machineName);
public PerformanceCounterCategory(string categoryName, string machineName);
new System.Diagnostics.PerformanceCounterCategory : string * string -> System.Diagnostics.PerformanceCounterCategory
Public Sub New (categoryName As String, machineName As String)

パラメーター

categoryName
String

この PerformanceCounterCategory インスタンスを関連付けるパフォーマンス カウンター カテゴリまたはパフォーマンス オブジェクトの名前。

machineName
String

パフォーマンス カウンター カテゴリとそれに関連付けられているカウンターが存在するコンピューター。

例外

categoryNameは空の文字列 ("") です。

-又は-

machineName 構文が無効です。

categoryName は null です。

例

次のコード例では、コマンド ラインから PerformanceCounterCategory 名とコンピューター名を受け取ります。 指定されたパラメーターの数に適したコンストラクター オーバーロードを使用して PerformanceCounterCategory を作成し、そのプロパティを表示します。

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

    // Copy the supplied arguments into the local variables.
    try
    {
        categoryName = args[0];
        machineName = args[1]=="."? "": args[1];
    }
    catch(Exception ex)
    {
        // Ignore the exception from non-supplied arguments.
    }

    // Create a PerformanceCounterCategory object using
    // the appropriate constructor.
    if (categoryName.Length==0)
    {
        pcc = new PerformanceCounterCategory();
    }
    else if(machineName.Length==0)
    {
        pcc = new PerformanceCounterCategory(categoryName);
    }
    else
    {
        pcc = new PerformanceCounterCategory(categoryName, 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 PerformanceCounterCategory

    ' Copy the supplied arguments into the local variables.
    Try
        categoryName = args(0)
        machineName = IIf(args(1) = ".", "", args(1))
    Catch ex As Exception
        ' Ignore the exception from non-supplied arguments.
    End Try

    ' Create a PerformanceCounterCategory object using 
    ' the appropriate constructor.
    If categoryName.Length = 0 Then
        pcc = New PerformanceCounterCategory
    ElseIf machineName.Length = 0 Then
        pcc = New PerformanceCounterCategory(categoryName)
    Else
        pcc = New PerformanceCounterCategory(categoryName, machineName)
    End If

    ' 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

こちらもご覧ください

適用対象