KeyContainerPermissionAccessEntryEnumerator 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
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
- 属性
- 实现
注意
代码访问安全性 (CAS) 已在所有版本的 .NET Framework 和 .NET 中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求用于完成安全任务的替代方法。
枚举器仅允许读取集合中的数据。 枚举器不能用于修改基础集合。
最初,枚举数定位在集合中第一个元素的前面。 方法 Reset 还会将枚举器带回此位置。 在此位置,调用 Current 属性将引发异常。 因此,在读取 属性的值Current之前,必须调用 MoveNext 方法将枚举器推进到集合的第一个元素。
在调用 Current 或 MoveNext 之前,Reset 返回同一对象。 MoveNext 将 Current 设置为下一个元素。
在传递到集合的末尾之后,枚举数放在集合中最后一个元素后面,且调用 MoveNext 会返回 false
。 如果最后一次调用 MoveNext 返回 , false
则调用 Current 将引发异常。 若要重置 Current 为集合的第一个元素,请调用 Reset ,然后调用 MoveNext。
只要集合保持不变,枚举器就仍有效。 如果对集合进行了更改(例如添加、修改或删除元素),枚举器将不可恢复地失效,下一次InvalidOperationException调用 MoveNext 或 Reset 引发 。 如果在调用 MoveNext 和 CurrentCurrent 之间修改集合,则返回当前设置它的元素,即使枚举器已失效。
枚举数没有对集合的独占访问权;因此,从头到尾对一个集合进行枚举在本质上不是一个线程安全的过程。 即使某个集合已同步,其他线程仍可以修改该集合,这会导致枚举数引发异常。 若要确保枚举过程中的线程安全性,可以在整个枚举期间锁定集合,或者捕获由其他线程进行的更改所导致的异常。
Key |
已过时.
初始化 KeyContainerPermissionAccessEntryEnumerator 类的新实例。 |
Current |
已过时.
获取集合中的当前项。 |
Equals(Object) |
已过时.
确定指定对象是否等于当前对象。 (继承自 Object) |
Get |
已过时.
作为默认哈希函数。 (继承自 Object) |
Get |
已过时.
获取当前实例的 Type。 (继承自 Object) |
Memberwise |
已过时.
创建当前 Object 的浅表副本。 (继承自 Object) |
Move |
已过时.
移至集合中的下一元素。 |
Reset() |
已过时.
将枚举数重置到集合的开头。 |
To |
已过时.
返回表示当前对象的字符串。 (继承自 Object) |
IEnumerator. |
已过时.
获取集合中的当前对象。 |
产品 | 版本 (已过时) |
---|---|
.NET | (8 (package-provided), 9 (package-provided)) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1 (5, 6, 7, 8, 9) |