WindowsIdentity.Groups プロパティ

定義

現在の Windows ユーザーが属しているグループを取得します。

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

プロパティ値

IdentityReferenceCollection

現在の Windows ユーザーが属しているグループを表すオブジェクト。

次のコード例は、 プロパティを使用して、現在のユーザーが属しているグループの ID 参照 Groups を表示する方法を示しています。 このコード例は、WindowsIdentity クラスのために提供されている大規模な例の一部です。

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

適用対象