Redigera

Dela via


PermissionSet.GetEnumerator Method

Definition

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

Returns

An enumerator object for the permissions of the set.

Implements

Examples

The following code example shows the use of the GetEnumerator method to list all the permissions in a permission set. This 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

Remarks

Use the enumerator as an index to access individual permission objects in the set.

Notes to Inheritors

When you inherit from PermissionSet, you can change the behavior of the GetEnumerator() method by overriding the GetEnumeratorImpl() method.

Applies to