1
我得到以下錯誤:VB.NET - 錯誤參考到非共享成員需要的對象引用(WindowsIdentity.Groups性)
Error 1 Reference to a non-shared member requires an object reference.
(on WindowsIdentity.Groups)
這是我的代碼從使用WindowsIdentity.Groups property顯示當前用戶所屬組的標識引用。此代碼是爲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
我試圖把修復這個錯誤:
Dim myWindowsIdentity As New WindowsIdentity
而且得到了以下錯誤:
Error 2 Overload resolution failed because no accessible 'New' accepts
this number of arguments.
我不知道該放什麼,有7個選項提供的intellisense – 2011-04-27 17:06:34
提供它的參數最符合什麼目的你正在嘗試執行,如果你不知道,谷歌的對象 – FreeSnow 2011-04-27 17:10:05
Uhhhhh「谷歌它」不是一個有用的答案哈哈。任何其他建議? – 2011-04-28 15:57:36