Share via


WindowsIdentity.Groups Eigenschaft

Definition

Ruft die Gruppen ab, zu denen der aktuelle Windows-Benutzer gehört.

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

Eigenschaftswert

Ein Objekt, das die Gruppen darstellt, zu denen der Windows-Benutzer gehört.

Beispiele

Das folgende Codebeispiel zeigt die Verwendung der Groups -Eigenschaft zum Anzeigen der Identitätsverweise für die Gruppen, zu der der aktuelle Benutzer gehört. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die WindowsIdentity-Klasse bereitgestellt wird.

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

Gilt für: