PerformanceCounterCategory.GetInstanceNames メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > PerformanceCounterCategory.GetInstanceNames メソッドの意味・解説 

PerformanceCounterCategory.GetInstanceNames メソッド

このカテゴリ関連付けられたパフォーマンス オブジェクト インスタンスの一覧を取得します

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Dim instance As PerformanceCounterCategory
Dim returnValue As String()

returnValue = instance.GetInstanceNames
public string[] GetInstanceNames ()
public:
array<String^>^ GetInstanceNames ()
public String[] GetInstanceNames ()
public function GetInstanceNames () : String[]

戻り値
このカテゴリ関連付けられたパフォーマンス オブジェクト インスタンス名を表す文字列の配列。または、カテゴリ含まれるパフォーマンス オブジェクト インスタンス1 つだけ場合は、空の文字列 ("") が格納され単一エントリの配列

例外例外
例外種類条件

InvalidOperationException

CategoryName プロパティnull 参照 (Visual Basic では Nothing) です。プロパティ設定されていない可能性あります

または

カテゴリには関連付けられたインスタンスはありません。

Win32Exception

基になるシステム API呼び出し失敗しました

使用例使用例

PerformanceCounterCategory 内の PerformanceCounter オブジェクトリスト取得するコード例次に示します最初にコンピュータ名が指定されたかどうかに基づいて適切なコンストラクタPerformanceCounterCategory オブジェクト作成します次にGetInstanceNames使用し並べ替え表示するためのString配列としてインスタンス名を返します

Sub Main(ByVal args() As
 String)
    Dim categoryName As String
 = ""
    Dim machineName As String
 = ""
    Dim pcc As PerformanceCounterCategory
    Dim instances() As String

    ' 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

    Try
        ' Create the appropriate PerformanceCounterCategory object.
        If machineName.Length > 0 Then
            pcc = New PerformanceCounterCategory(categoryName,
 machineName)
        Else
            pcc = New PerformanceCounterCategory(categoryName)
        End If

        ' Get the instances associated with this category.
        instances = pcc.GetInstanceNames()

    Catch ex As Exception
        Console.WriteLine("Unable to get instance information
 for " & _
             "category ""{0}""
 on " & IIf(machineName.Length > 0, _
             "computer ""{1}"":",
 "this computer:"), _
             categoryName, machineName)
        Console.WriteLine(ex.Message)
        Return
    End Try

    'If an empty array is returned, the category has a single instance.
    If instances.Length = 0 Then
        Console.WriteLine( _
            "Category ""{0}""
 on " & IIf(machineName.Length > 0, _
            "computer ""{1}""",
 "this computer") & _
            " is single-instance.", pcc.CategoryName,
 pcc.MachineName)
    Else
        ' Otherwise, display the instances.
        Console.WriteLine( _
            "These instances exist in category ""{0}""
 on " & _
            IIf(machineName.Length > 0, _
                "computer ""{1}"".",
 "this computer:"), _
            pcc.CategoryName, pcc.MachineName)

        Array.Sort(instances)
        Dim objX As Integer
        For objX = 0 To instances.Length -
 1
            Console.WriteLine("{0,4} - {1}", objX
 + 1, instances(objX))
        Next objX
    End If
End Sub
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PerformanceCounterCategory クラス
PerformanceCounterCategory メンバ
System.Diagnostics 名前空間
CategoryName
PerformanceCounter.InstanceName プロパティ
PerformanceCounter クラス


このページでは「.NET Framework クラス ライブラリ リファレンス」からPerformanceCounterCategory.GetInstanceNames メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からPerformanceCounterCategory.GetInstanceNames メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からPerformanceCounterCategory.GetInstanceNames メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

PerformanceCounterCategory.GetInstanceNames メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



PerformanceCounterCategory.GetInstanceNames メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS