VB.NET
クラスのプロパティを宣言する
http://dobon.net/vb/dotnet/vb6/property.html
引用:
[VB.NET]
Public Class SampleClass
Private num1 As Integer = 0
Private num2 As Integer = 0
Private num3 As Integer = 0
‘GetとSetがあるとき
Public Property Number1() As Integer
Get
Return num1
End Get
Set(ByVal Value)
num1 = Value
End Set
End Property
‘Getしかない時はReadOnlyを付ける
Public ReadOnly Property Number2() As Integer
Get
Return num2
End Get
End Property
‘Setしかない時はWriteOnlyを付ける
Public WriteOnly Property Number3() As Integer
Set(ByVal Value)
num3 = Value
End Set
End Property
End Class
コメント