Groups Property

WindowsIdentity.Groups Property

 

Gets the groups the current Windows user belongs to.

Namespace:   System.Security.Principal
Assembly:  mscorlib (in mscorlib.dll)

public IdentityReferenceCollection Groups { get; }

Property Value

Type: System.Security.Principal.IdentityReferenceCollection

An object representing the groups the current Windows user belongs to.

The following code example shows the use of the Groups property to display the identity references for the groups the current user belongs to. This code example is part of a larger example provided for the WindowsIdentity class.

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

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft