KeyContainerPermissionAccessEntryEnumerator 類別

定義

警告

Code Access Security is not supported or honored by the runtime.

public ref class KeyContainerPermissionAccessEntryEnumerator sealed : System::Collections::IEnumerator
public sealed class KeyContainerPermissionAccessEntryEnumerator : System.Collections.IEnumerator
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class KeyContainerPermissionAccessEntryEnumerator : System.Collections.IEnumerator
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class KeyContainerPermissionAccessEntryEnumerator : System.Collections.IEnumerator
type KeyContainerPermissionAccessEntryEnumerator = class
    interface IEnumerator
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type KeyContainerPermissionAccessEntryEnumerator = class
    interface IEnumerator
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type KeyContainerPermissionAccessEntryEnumerator = class
    interface IEnumerator
Public NotInheritable Class KeyContainerPermissionAccessEntryEnumerator
Implements IEnumerator
繼承
KeyContainerPermissionAccessEntryEnumerator
屬性
實作

備註

枚舉器只允許讀取集合中的資料。Enumerators allow only 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 方法,將列舉值前進到集合中的第一個元素,然後再讀取屬性的值 CurrentTherefore, 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.

Current 會傳回相同的物件直到呼叫 MoveNextResetCurrent returns the same object until either MoveNext or Reset is called. MoveNext 會將 Current 設定為下一個項目。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 例外狀況 CurrentIf the last call to MoveNext returned false, calling Current throws an exception. 若要重設 Current 為集合的第一個元素,請呼叫, Reset 然後呼叫 MoveNextTo 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. 如果對集合進行了變更,例如加入、修改或刪除元素,列舉值將無法回復地失效,且下一次呼叫或會擲回 MoveNext Reset InvalidOperationExceptionIf 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. 如果在呼叫和之間修改集合,則會傳回 MoveNext Current 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.

建構函式

KeyContainerPermissionAccessEntryEnumerator()

將 KeyContainerPermissionAccessEntryEnumerator 類別的新執行個體初始化。Initializes a new instance of the KeyContainerPermissionAccessEntryEnumerator class.

屬性

Current

取得集合中的目前項目。Gets the current entry in the collection.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MoveNext()

移至集合中的下一個項目。Moves to the next element in the collection.

Reset()

將列舉值重設為集合的開頭。Resets the enumerator to the beginning of the collection.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

IEnumerator.Current

取得集合中目前的物件。Gets the current object in the collection.

適用於