ApplicationTrustEnumerator 类


表示 ApplicationTrustCollection 集合中的 ApplicationTrust 对象的枚举数。Represents the enumerator for ApplicationTrust objects in the ApplicationTrustCollection collection.

public ref class ApplicationTrustEnumerator sealed : System::Collections::IEnumerator
public sealed class ApplicationTrustEnumerator : System.Collections.IEnumerator
type ApplicationTrustEnumerator = class
    interface IEnumerator
Public NotInheritable Class ApplicationTrustEnumerator
Implements IEnumerator


枚举器仅允许读取集合中的数据。Enumerators only allow reading the data in the collection. 枚举器不能用于修改基础集合。Enumerators cannot be used to modify the underlying collection.

最初,枚举数定位在集合中第一个元素的前面。Initially, the enumerator is positioned before the first element in the collection. Reset方法还将枚举器恢复到此位置。The Reset method also brings the enumerator back to this position. 在此位置, 调用Current属性会引发异常。At this position, calling the Current property throws an exception. 因此, 在读取MoveNext Current属性的值之前, 必须调用方法以将枚举数前移到集合的第一个元素。Therefore, you must call the MoveNext method to advance the enumerator to the first element of the collection before reading the value of the Current property.

在调用 CurrentMoveNext 之前,Reset 返回同一对象。Current returns the same object until either MoveNext or Reset is called. MoveNextCurrent 设置为下一个元素。MoveNext sets Current to the next element.

在传递到集合的末尾之后,枚举数放在集合中最后一个元素后面,且调用 MoveNext 会返回 falseAfter the end of the collection is passed, the enumerator is positioned after the last element in the collection, and calling MoveNext returns false. 如果最后一次调用MoveNext返回false, 则Current调用会引发异常。If the last call to MoveNext returned false, calling Current throws an exception. 若要Current重置为集合的第一个元素, Reset请调用, MoveNext然后调用。To reset Current to the first element of the collection, call Reset followed by a call to MoveNext.

只要集合保持不变,枚举数就保持有效。An enumerator remains valid as long as the collection remains unchanged. 如果对集合所做的更改 (如添加、修改或删除元素), 则枚举器将失效且不可恢复, 并且对MoveNextReset的下InvalidOperationException一个调用将引发异常。If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to MoveNext or Reset throws an InvalidOperationException exception. 如果在调用MoveNextCurrent之间修改了集合, Current则将返回当前设置它的元素, 即使枚举器已失效。If the collection is modified between calling MoveNext and Current, Current returns the element to which it is currently set, even if the enumerator is already invalidated.

枚举数没有对集合的独占访问权;因此,从头到尾对一个集合进行枚举在本质上不是一个线程安全的过程。The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. 即使某个集合已同步,其他线程仍可以修改该集合,这会导致枚举数引发异常。Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. 若要确保枚举过程中的线程安全性,可以在整个枚举期间锁定集合,或者捕获由其他线程进行的更改所导致的异常。To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.



获取 ApplicationTrust 集合中的当前 ApplicationTrustCollection 对象。Gets the current ApplicationTrust object in the ApplicationTrustCollection collection.



确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)

移动到 ApplicationTrustCollection 集合中的下一个元素。Moves to the next element in the ApplicationTrustCollection collection.


将枚举数重置到 ApplicationTrustCollection 集合的开头。Resets the enumerator to the beginning of the ApplicationTrustCollection collection.


返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)



获取 Object 集合中的当前 ApplicationTrustCollectionGets the current Object in the ApplicationTrustCollection collection.