Udostępnij przez


WindowsIdentity.Groups Właściwość

Definicja

Pobiera grupy, do których należy bieżący użytkownik systemu Windows.

public:
 property System::Security::Principal::IdentityReferenceCollection ^ Groups { System::Security::Principal::IdentityReferenceCollection ^ get(); };
public System.Security.Principal.IdentityReferenceCollection? Groups { get; }
public System.Security.Principal.IdentityReferenceCollection Groups { get; }
member this.Groups : System.Security.Principal.IdentityReferenceCollection
Public ReadOnly Property Groups As IdentityReferenceCollection

Wartość właściwości

Obiekt reprezentujący grupy, do których należy bieżący użytkownik systemu Windows.

Przykłady

Poniższy przykład kodu przedstawia użycie Groups właściwości do wyświetlania odwołań tożsamości dla grup, do których należy bieżący użytkownik. Ten przykład kodu jest częścią większego przykładu udostępnionego WindowsIdentity dla klasy .

// Display the SIDs for the groups the current user belongs to.
Console.WriteLine("Display the SIDs for the groups the current user belongs to.");
IdentityReferenceCollection irc = windowsIdentity.Groups;
foreach (IdentityReference ir in irc)
    Console.WriteLine(ir.Value);
' Display the SIDs for the groups the current user belongs to.
Console.WriteLine("Display the SIDs for the groups the current user belongs to.")
Dim irc As IdentityReferenceCollection
Dim ir As IdentityReference
irc = windowsIdentity.Groups
For Each ir In irc
    Console.WriteLine(ir.Value)
Next

Dotyczy