WindowsIdentity.Groups Proprietà

Definizione

Ottiene i gruppi ai quali appartiene l'utente 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à

IdentityReferenceCollection

Oggetto che rappresenta i gruppi ai quali appartiene l'utente Windows corrente.

Esempio

Nell'esempio di codice seguente viene illustrato l'utilizzo della proprietà per visualizzare i riferimenti di Groups 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