最佳答案
像这样:
Private Thingy As Integer
Property Thing() As Integer
Get
Return Thingy
End Get
Private Set(ByVal value As Integer)
Thingy = value
End Set
End Property
VB10 中的汽车属性
Property PartNo As Integer = 44302
但是使用私有(private)集仍然无法在 VB 中完成,甚至在 VB10 中也无法完成,请参见此处:
来自 MSDN(正如约翰所说):
Property Definitions That Require Standard Syntax :
- Specify different accessibility for the Get and Set procedure. For example, you might want to make the Set procedure Private and the Get procedure Public.
关于vb.net - 如何在 VB 10 中编写私有(private)设置自动属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/968971/