PerformanceCounterCategory.GetInstanceNames メソッド
アセンブリ: System (system.dll 内)

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


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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


PerformanceCounterCategory クラス
PerformanceCounterCategory メンバ
System.Diagnostics 名前空間
CategoryName
PerformanceCounter.InstanceName プロパティ
PerformanceCounter クラス
Weblioに収録されているすべての辞書からPerformanceCounterCategory.GetInstanceNames メソッドを検索する場合は、下記のリンクをクリックしてください。

- PerformanceCounterCategory.GetInstanceNames メソッドのページへのリンク