Share via


WindowsIdentity.Groups Properti

Definisi

Mendapatkan grup milik pengguna Windows saat ini.

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

Nilai Properti

Objek yang mewakili grup milik pengguna Windows saat ini.

Contoh

Contoh kode berikut menunjukkan penggunaan Groups properti untuk menampilkan referensi identitas untuk grup tempat pengguna saat ini berada. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk WindowsIdentity kelas .

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

Berlaku untuk