WindowsIdentity.Groups Propriedade

Definição

Obtém os grupos aos quais o usuário atual do Windows pertence.

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

Valor da propriedade

IdentityReferenceCollection

Um objeto que representa os grupos aos quais o usuário atual do Windows pertence.

Exemplos

O exemplo de código a seguir mostra o uso da Groups propriedade para exibir as referências de identidade para os grupos aos quais o usuário atual pertence. Este exemplo de código faz parte de um exemplo maior fornecido para a 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

Aplica-se a