PropertyDataCollection.GetEnumerator 方法

定义

返回此 PropertyDataCollection 的枚举数。Returns the enumerator for this PropertyDataCollection.

public:
 System::Management::PropertyDataCollection::PropertyDataEnumerator ^ GetEnumerator();
public System.Management.PropertyDataCollection.PropertyDataEnumerator GetEnumerator ();
member this.GetEnumerator : unit -> System.Management.PropertyDataCollection.PropertyDataEnumerator
Public Function GetEnumerator () As PropertyDataCollection.PropertyDataEnumerator

返回

可用于循环访问集合的 IEnumeratorAn IEnumerator that can be used to iterate through the collection.

注解

仅可通过一次只进枚举器循环For Each访问 (就C# For像在 Visual Basic .net 语句或语句中)。You can only iterate (as in a Visual Basic .NET For Each statement or a C# For statement) through a forward-only enumerator one time. 包含实例的内存由 WMI 释放, 因此无法倒带枚举器。The memory containing the instances is released by WMI so that the enumerator cannot be rewound. 因此, 不Count能使用方法, 因为它需要倒带枚举器。Therefore, the Count method cannot be used since it requires rewinding the enumerator.

与传统枚举器相比, 只进枚举器的速度要快得多, 使用的内存更少, Reset但它们不允许调用。Forward-only enumerators are generally much faster and use less memory than conventional enumerators, but they do not allow calls to Reset.

如果枚举数为可回退, 则集合中的对象将可供多个枚举使用。If an enumerator is rewindable, the objects in the collection will be kept available for multiple enumerations.

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息, 请参阅从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于