VB.NET-对非共享成员的错误引用需要对象引用(WindowsIdentity.Groups属性)
|
我收到以下错误:
Error 1 Reference to a non-shared member requires an object reference.
(on WindowsIdentity.Groups)
这是我的代码,其中使用WindowsIdentity.Groups属性显示当前用户所属组的标识引用。此代码是为WindowsIdentity类提供的一个较大示例的一部分。
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
我尝试通过以下方式解决此错误:
Dim myWindowsIdentity As New WindowsIdentity
但出现以下错误:
Error 2 Overload resolution failed because no accessible \'New\' accepts
this number of arguments.
没有找到相关结果
已邀请:
1 个回复
舶啥戚