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 中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求使用替代方法来完成安全任务。

枚举器只允许读取集合中的数据。 枚举器不能用于修改基础集合。

最初,枚举数定位在集合中第一个元素的前面。 方法 Reset 还会使枚举器回到此位置。 在此位置,调用 Current 属性将引发异常。 因此,在读取 属性的值Current之前,必须调用 MoveNext 方法以将枚举器前进到集合的第一个元素。

在调用 CurrentMoveNext 之前,Reset 返回同一对象。 MoveNextCurrent 设置为下一个元素。

在传递到集合的末尾之后,枚举数放在集合中最后一个元素后面,且调用 MoveNext 会返回 false。 如果对 返回false的最后一MoveNext次调用,则调用 Current 将引发异常。 若要重置 Current 为集合的第一个元素,请调用 Reset ,然后调用 MoveNext

只要集合保持不变,枚举器就仍有效。 如果对集合进行了更改(例如添加、修改或删除元素),枚举器将不可恢复地失效,并且下一次InvalidOperationException调用 MoveNextReset 将引发 。 如果在调用 MoveNextCurrent之间修改集合, Current 则返回当前设置它的元素,即使枚举器已失效也是如此。

枚举数没有对集合的独占访问权;因此,从头到尾对一个集合进行枚举在本质上不是一个线程安全的过程。 即使某个集合已同步,其他线程仍可以修改该集合,这会导致枚举数引发异常。 若要确保枚举过程中的线程安全性,可以在整个枚举期间锁定集合,或者捕获由其他线程进行的更改所导致的异常。

构造函数

KeyContainerPermissionAccessEntryEnumerator()
已过时.

初始化 KeyContainerPermissionAccessEntryEnumerator 类的新实例。

属性

Current
已过时.

获取集合中的当前项。

方法

Equals(Object)
已过时.

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()
已过时.

作为默认哈希函数。

(继承自 Object)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
MoveNext()
已过时.

移至集合中的下一元素。

Reset()
已过时.

将枚举数重置到集合的开头。

ToString()
已过时.

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

IEnumerator.Current
已过时.

获取集合中的当前对象。

适用于