InstanceDataCollectionCollection.Keys Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft das Objekt und die Zählerregistrierungsschlüssel für die Objekte ab, die dieser Instanzdatensammlung zugeordnet sind.
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
Eigenschaftswert
Ein ICollection Satz objektspezifischer Registrierungsschlüssel.
Beispiele
The following code example uses the Keys property of an InstanceDataCollectionCollection to return a collection of counter names, which it converts to an array of String. Es generiert ein Array von InstanceDataCollection Objekten mithilfe der Values Eigenschaft. Für jedes Element im Array von Zählernamen zeigt es den Namen an und ruft eine Funktion auf, um die zugeordnete InstanceDataCollectionzu verarbeiten.
// 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
Hinweise
Jede Softwarekomponente erstellt Schlüssel für ihre Objekte und Leistungsindikatoren, wenn sie installiert ist, und schreibt Zählerdaten während der Ausführung. Sie können auf diese Daten zugreifen, wie Sie auf andere Registrierungsdaten zugreifen würden. Obwohl Sie die Registrierung zum Sammeln von Leistungsdaten verwenden, werden die Daten nicht in der Registrierungsdatenbank gespeichert. Stattdessen sammelt das System die Daten aus den entsprechenden Systemobjektmanagern.