VB.Net を使用します。
次のようなプロパティを宣言しました。
Private _name as String
Private _address as String
Public Property Name as String
Get
Return _name
End Get
Set(value as String)
_name = value
End Set
End Property
Public Property Address as String
Get
Return _address
End Get
Set(value as String)
_address= value
End Set
End Property
get と set を処理する別の変数の宣言を最小限に抑えたいと考えています。この変数または関数はすべてのプロパティで使用され、すべてのプロパティの値の取得と設定をすべて処理します。
例えば:
Public Property Address as String
Get
Return address /*Insert function here that can be use by all property*/
End Get
Set(value as String)
address = value /*Insert function here that can be use by all property*/
End Set
End Property
前もって感謝します。