Condividi tramite


WindowsIdentity.Groups Proprietà

Definizione

Ottiene i gruppi a cui appartiene l'utente di Windows corrente.

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

Valore della proprietà

Oggetto che rappresenta i gruppi a cui appartiene l'utente di Windows corrente.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso della Groups proprietà per visualizzare i riferimenti di identità per i gruppi a cui appartiene l'utente corrente. Questo esempio di codice fa parte di un esempio più ampio fornito per 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

Si applica a