InstanceDataCollectionCollection.Values 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取组成计数器实例集合的实例数据值。
public:
property System::Collections::ICollection ^ Values { System::Collections::ICollection ^ get(); };
public System.Collections.ICollection Values { get; }
member this.Values : System.Collections.ICollection
Public ReadOnly Property Values As ICollection
属性值
一个 ICollection,它表示计数器的实例和它们的关联数据值。
示例
下面的代码示例使用 Values 的 InstanceDataCollectionCollection 属性返回 对象的集合,该集合 InstanceDataCollection 将转换为数组。 它使用 Keys 属性生成计数器名称数组。 对于 对象数组 InstanceDataCollection 中的每个元素,它显示关联的计数器名称,并调用函数来处理 InstanceDataCollection。
// 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