Aracılığıyla paylaş


InstanceDataCollection.Keys Özellik

Tanım

Bu örnek verileriyle ilişkili nesneler için 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 InstanceDataCollection diziye dönüştürdüğü örnek adları koleksiyonunu döndürmek için özelliğini StringkullanırKeys. özelliğini kullanarak Values bir nesne dizisi InstanceData oluşturur. Örnek adları dizisindeki her öğe için adı görüntüler ve ilişkili InstanceData nesneyi işlemek için bir işlev çağırır.

// Display the contents of an InstanceDataCollection.
public static void ProcessInstanceDataCollection(InstanceDataCollection idCol)
{

    ICollection idColKeys = idCol.Keys;
    string[] idColKeysArray = new string[idColKeys.Count];
    idColKeys.CopyTo(idColKeysArray, 0);

    ICollection idColValues = idCol.Values;
    InstanceData[] idColValuesArray = new InstanceData[idColValues.Count];
    idColValues.CopyTo(idColValuesArray, 0);

    Console.WriteLine("  InstanceDataCollection for \"{0}\" " +
        "has {1} elements.", idCol.CounterName, idCol.Count);

    // Display the InstanceDataCollection Keys and Values.
    // The Keys and Values collections have the same number of elements.
    int index;
    for(index=0; index<idColKeysArray.Length; index++)
    {
        Console.WriteLine("    Next InstanceDataCollection " +
            "Key is \"{0}\"", idColKeysArray[index]);
        ProcessInstanceDataObject(idColValuesArray[index]);
    }
}
' Display the contents of an InstanceDataCollection.
Sub ProcessInstanceDataCollection(ByVal idCol As InstanceDataCollection)

    Dim idColKeys As ICollection = idCol.Keys
    Dim idColKeysArray(idColKeys.Count - 1) As String
    idColKeys.CopyTo(idColKeysArray, 0)

    Dim idColValues As ICollection = idCol.Values
    Dim idColValuesArray(idColValues.Count - 1) As InstanceData
    idColValues.CopyTo(idColValuesArray, 0)

    Console.WriteLine("  InstanceDataCollection for ""{0}"" " & _
        "has {1} elements.", idCol.CounterName, idCol.Count)

    ' Display the InstanceDataCollection Keys and Values.
    ' The Keys and Values collections have the same number of elements.
    Dim index As Integer
    For index = 0 To idColKeysArray.Length - 1
        Console.WriteLine("    Next InstanceDataCollection " & _
            "Key is ""{0}""", idColKeysArray(index))
        ProcessInstanceDataObject(idColValuesArray(index))
    Next index
End Sub

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şebileceğ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 nesnesi yöneticilerinden toplar.

Şunlara uygulanır