語言

KeyContainerPermissionAccessEntryEnumerator 類別

定義

警告

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

public ref class KeyContainerPermissionAccessEntryEnumerator sealed : 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
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}")>]
type KeyContainerPermissionAccessEntryEnumerator = class
    interface IEnumerator
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type KeyContainerPermissionAccessEntryEnumerator = class
    interface IEnumerator
type KeyContainerPermissionAccessEntryEnumerator = class
    interface IEnumerator
Public NotInheritable Class KeyContainerPermissionAccessEntryEnumerator
Implements IEnumerator
繼承
KeyContainerPermissionAccessEntryEnumerator
屬性
實作

備註

注意事項

.NET Framework 和 .NET 的所有版本中,代碼存取安全性(CAS)已被棄用。 最新版本的 .NET 不會接受 CAS 註釋,如果使用 CAS 相關 API,則會產生錯誤。 開發人員應尋求其他方法來完成安全任務。

列舉器只允許讀取集合中的資料。 列舉器無法用來修改底層集合。

最初,列舉器會被放置在集合中的第一個元素之前。 此 Reset 方法也會將調查員拉回此位置。 此時,呼叫該 Current 屬性會拋出例外。 因此,你必須先呼叫 MoveNext 方法,將列舉器推進到集合的第一個元素,然後再讀取屬性的 Current 值。

Current 回傳相同物件,直到被呼叫其中一 MoveNext 或 Reset 。 MoveNext 設定 Current 為下一個元素。

在集合結束後,列舉器會被置於集合的最後一個元素之後,呼叫 MoveNextfalse返回 。 如果最後一次呼叫回傳MoveNext,false呼叫Current會拋出例外。 要重置Current到集合的第一個元素,先呼叫Reset,接著呼叫 。MoveNext

只要集合未曾改變,列舉器仍然有效。 若對集合進行變更,例如新增、修改或刪除元素,列舉子將無法恢復地失效,下一次呼叫 MoveNext 或 Reset 會拋 InvalidOperationException出 。 若集合在呼叫 MoveNext 與 Current之間被修改, Current 則會回傳其目前設定的元素,即使列舉器已被失效。

列舉值沒有集合的獨佔存取權;因此,透過集合列舉本質上不是安全線程的程式。 即使集合同步處理,其他線程仍然可以修改集合,這會導致列舉值擲回例外狀況。 若要保證列舉期間的線程安全性,您可以在整個列舉期間鎖定集合,或攔截其他線程所做的變更所產生的例外狀況。

建構函式

名稱 Description
KeyContainerPermissionAccessEntryEnumerator()
已淘汰.

初始化 KeyContainerPermissionAccessEntryEnumerator 類別的新實例。

屬性

名稱 Description
Current
已淘汰.

取得收藏中目前的條目。

方法

名稱 Description
Equals(Object)
已淘汰.

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

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

做為預設哈希函式。

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

取得目前實例的 Type。

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

建立目前 Object的淺層複本。

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

移至集合中的下一個元素。

Reset()
已淘汰.

將列舉器重設到集合的開頭。

ToString()
已淘汰.

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

(繼承來源 Object)

明確介面實作

名稱 Description
IEnumerator.Current
已淘汰.

取得集合中目前的物件。

適用於