我要把Str1属性实现共享,但是添加Shared修饰符后无法使用。该如何实现共享Shared?
Public Shared Property Str1() As String
Get
Return newPropertyValue
End Get
Set(ByVal value As String)
newPropertyValue = value
End Set
End Property
------解决方案--------------------
没用好,乱套了。我重新贴吧。
Public Class Class2
Private Shared Number1 As String '需要使用Shared
Public Shared Property Str1() As String
Get
Return Number1 '不应该返回Str1
End Get
Set(ByVal value As String)
Number1 = value
End Set
End Property
Shared Sub MySub()
End Sub
End Class