WindowsIdentity.Groups Propriété

Définition

Obtient les groupes auxquels l'utilisateur Windows actuel appartient.

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

Valeur de propriété

IdentityReferenceCollection

Objet qui représente les groupes auxquels l'utilisateur Windows actuel appartient.

Exemples

L’exemple de code suivant illustre l’utilisation de la Groups propriété pour afficher les références d’identité pour les groupes auxquels l’utilisateur actuel appartient. Cet exemple de code fait partie d’un exemple plus complet fourni pour la WindowsIdentity classe.

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

S’applique à