Aracılığıyla paylaş


InstanceDataCollectionCollection.Keys Özellik

Tanım

Bu örnek veri koleksiyonuyla ilişkili nesnelerin nesne ve sayaç kayıt defteri anahtarlarını alır.

public:
 property System::Collections::ICollection ^ Keys { System::Collections::ICollection ^ get(); };
public System.Collections.ICollection Keys { get; }
member this.Keys : System.Collections.ICollection
Public ReadOnly Property Keys As ICollection

Özellik Değeri

ICollection Nesneye özgü kayıt defteri anahtarları kümesini temsil eden.

Örnekler

Aşağıdaki kod örneği, bir diziye dönüştürdüğü sayaç adları koleksiyonunu döndürmek için özelliğini Stringkullanır KeysInstanceDataCollectionCollection. özelliğini kullanarak Values bir nesne dizisi InstanceDataCollection oluşturur. Sayaç adları dizisindeki her öğe için adı görüntüler ve ilişkili InstanceDataCollectionöğesini işlemek için bir işlev çağırır.


// Process the InstanceDataCollectionCollection for this category.
PerformanceCounterCategory pcc = new PerformanceCounterCategory(categoryName);
InstanceDataCollectionCollection idColCol = pcc.ReadCategory();

ICollection idColColKeys = idColCol.Keys;
string[] idCCKeysArray = new string[idColColKeys.Count];
idColColKeys.CopyTo(idCCKeysArray, 0);

ICollection idColColValues = idColCol.Values;
InstanceDataCollection[] idCCValuesArray = new InstanceDataCollection[idColColValues.Count];
idColColValues.CopyTo(idCCValuesArray, 0);

Console.WriteLine("InstanceDataCollectionCollection for \"{0}\" " +
    "has {1} elements.", categoryName, idColCol.Count);

// Display the InstanceDataCollectionCollection Keys and Values.
// The Keys and Values collections have the same number of elements.
int index;
for(index=0; index<idCCKeysArray.Length; index++)
{
    Console.WriteLine("  Next InstanceDataCollectionCollection " +
        "Key is \"{0}\"", idCCKeysArray[index]);
    ProcessInstanceDataCollection(idCCValuesArray[index]);
}

' Process the InstanceDataCollectionCollection for this category.
Dim pcc As New PerformanceCounterCategory(categoryName)
Dim idColCol As InstanceDataCollectionCollection = pcc.ReadCategory()

Dim idColColKeys As ICollection = idColCol.Keys
Dim idCCKeysArray(idColColKeys.Count - 1) As String
idColColKeys.CopyTo(idCCKeysArray, 0)

Dim idColColValues As ICollection = idColCol.Values
Dim idCCValuesArray(idColColValues.Count - 1) As InstanceDataCollection
idColColValues.CopyTo(idCCValuesArray, 0)

Console.WriteLine("InstanceDataCollectionCollection for ""{0}"" " & _
    "has {1} elements.", categoryName, idColCol.Count)

' Display the InstanceDataCollectionCollection Keys and Values.
' The Keys and Values collections have the same number of elements.
Dim index As Integer
For index = 0 To idCCKeysArray.Length - 1
    Console.WriteLine("  Next InstanceDataCollectionCollection " & _
        "Key is ""{0}""", idCCKeysArray(index))
    ProcessInstanceDataCollection(idCCValuesArray(index))
Next index

Açıklamalar

Her yazılım bileşeni, yüklendiğinde nesneleri ve sayaçları için anahtarlar oluşturur ve yürütülürken sayaç verileri yazar. Bu verilere, diğer kayıt defteri verilerine erişebildiğiniz gibi erişebilirsiniz. Ancak, performans verilerini toplamak için kayıt defterini kullanmanıza rağmen, veriler kayıt defteri veritabanında depolanmaz. Bunun yerine sistem, verileri uygun sistem nesne yöneticilerinden toplar.

Şunlara uygulanır