WindowsIdentity.Groups Property

 

Gets the groups the current Windows user belongs to.

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

Public ReadOnly Property Groups As IdentityReferenceCollection

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.")
Dim irc As IdentityReferenceCollection
Dim ir As IdentityReference
irc = windowsIdentity.Groups
For Each ir In irc
    Console.WriteLine(ir.Value)
Next

.NET Framework
Available since 2.0
Return to top
Show: