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
屬性
實作

備註

警告

程式碼啟用安全性 (CAS) 在所有版本的 .NET Framework 和 .NET 中已被取代。 最新版本的 .NET 不接受 CAS 批註,並在使用 CAS 相關 API 時產生錯誤。 開發人員應該尋求替代方式來完成安全性工作。

列舉值只允許讀取集合中的資料。 列舉值無法用來修改基礎集合。

一開始,列舉程式位在集合中的第一個項目之前。 方法 Reset 也會將列舉值帶回這個位置。 在這個位置,呼叫 Current 屬性會擲回例外狀況。 因此,您必須呼叫 MoveNext 方法,將列舉值前移至集合的第一個專案,再讀取 屬性的值 Current

Current 會傳回相同的物件直到呼叫 MoveNextResetMoveNext 會將 Current 設定為下一個項目。

在超過集合的末端後,列舉值會放置在集合最後一個元素之後,並且呼叫 MoveNext 會傳回 false。 如果最後一 MoveNext 次呼叫傳 false 回 ,則呼叫 Current 會擲回例外狀況。 若要重設為 Current 集合的第一個專案,請呼叫 Reset ,後面接著呼叫 MoveNext

只要集合維持不變,列舉值就仍維持有效。 如果對集合進行變更,例如新增、修改或刪除專案,列舉值就會無法復原,而下一次呼叫 MoveNextReset 會擲回 InvalidOperationException 。 如果在呼叫 MoveNextCurrent 之間修改集合, Current 則會傳回它目前設定的專案,即使列舉值已經失效也一樣。

列舉程式沒有集合的獨佔存取權,因此,列舉集合內容本質上並不是安全的執行緒程序。 即使集合經過同步化,其他的執行緒仍可修改該集合,使列舉值擲回例外狀況。 若要保證列舉過程的執行緒安全,您可以在整個列舉過程中鎖定集合,或攔截由其他執行緒的變更所造成的例外狀況。

建構函式

KeyContainerPermissionAccessEntryEnumerator()
已淘汰.

將 KeyContainerPermissionAccessEntryEnumerator 類別的新執行個體初始化。

屬性

Current
已淘汰.

取得集合中的目前項目。

方法

Equals(Object)
已淘汰.

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()
已淘汰.

做為預設雜湊函式。

(繼承來源 Object)
GetType()
已淘汰.

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()
已淘汰.

建立目前 Object 的淺層複製。

(繼承來源 Object)
MoveNext()
已淘汰.

移至集合中的下一個項目。

Reset()
已淘汰.

將列舉值重設為集合的開頭。

ToString()
已淘汰.

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

IEnumerator.Current
已淘汰.

取得集合中目前的物件。

適用於