PermissionSet.GetEnumerator 方法

定义

返回集的权限的枚举器。Returns an enumerator for the permissions of the set.

public:
 virtual System::Collections::IEnumerator ^ GetEnumerator();
public System.Collections.IEnumerator GetEnumerator ();
public virtual System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator
Public Overridable Function GetEnumerator () As IEnumerator

返回

IEnumerator

集的权限的枚举器对象。An enumerator object for the permissions of the set.

实现

示例

下面的代码示例演示 GetEnumerator 如何使用方法列出权限集中的所有权限。The following code example shows the use of the GetEnumerator method to list all the permissions in a permission set. 此代码示例是为类提供的更大示例的一部分 PermissionSetThis code example is part of a larger example provided for the PermissionSet class.

// Display results of PermissionSet::GetEnumerator.
IEnumerator^ psEnumerator = ps1->GetEnumerator();
while ( psEnumerator->MoveNext() )
{
   Console::WriteLine( psEnumerator->Current );
}
// Display results of PermissionSet.GetEnumerator.
IEnumerator psEnumerator = ps1.GetEnumerator();
while (psEnumerator.MoveNext())
{
    Console.WriteLine(psEnumerator.Current);
}
' Display results of PermissionSet.GetEnumerator.
Dim psEnumerator As IEnumerator = ps1.GetEnumerator()
While psEnumerator.MoveNext()
    Console.WriteLine(psEnumerator.Current)
End While

注解

使用枚举器作为索引来访问集中各个权限对象。Use the enumerator as an index to access individual permission objects in the set.

继承者说明

当从继承时 PermissionSet ,可以 GetEnumerator() 通过重写方法来更改方法的行为 GetEnumeratorImpl()When you inherit from PermissionSet, you can change the behavior of the GetEnumerator() method by overriding the GetEnumeratorImpl() method.

适用于