I am getting the following error:
Error 1 Reference to a non-shared member requires an object reference.
(on WindowsIdentity.Groups)
Here's my code from that uses the WindowsIdentity.Groups property to display the identity references for the groups the current user belongs to. This code is part of a larger example provided for the WindowsIdentity class.
Public ReadOnly Property Groups As IdentityReferenceCollection
Get
Dim irc As IdentityReferenceCollection
Dim ir As IdentityReference
irc = WindowsIdentity.Groups
For Each ir In irc
MsgBox(ir.Value)
Next
End Get
End Property
I tried fixing this error by putting:
Dim myWindowsIdentity As New WindowsIdentity
but got the following error:
Error 2 Overload resolution failed because no accessible 'New' accepts
this number of arguments.