Sdílet prostřednictvím


WindowsIdentity.Groups Vlastnost

Definice

Získá skupiny, do nichž aktuální uživatel Windows patří.

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

Hodnota vlastnosti

Objekt představující skupiny, ke které patří aktuální uživatel Windows.

Příklady

Následující příklad kódu ukazuje použití Groups vlastnosti k zobrazení odkazů na identitu pro skupiny, do které aktuální uživatel patří. Tento příklad kódu je součástí většího příkladu uvedeného pro třídu WindowsIdentity.

// 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

Platí pro