When the property get and set method has been called?
i have the following property开发者_JAVA技巧 declaration
Public Property IsAreaSelected() As Integer
Get
Return If(ViewState("IsAreaSelected") Is Nothing, 0, Cint(ViewState("IsAreaSelected")))
End Get
Set(ByVal value As Integer)
ViewState("IsAreaSelected") = value
End Set
End Property
i want to know when this set and get method will be called ?
will it be called when i execute
IsAreaSelected() =0
or is there anything like
IsAreaSelected().get()
or
IsAreaSelected().set()
??
You call (use) it exactly like a field in your class:
IsAreaSelected = 0
If AreaSelected > 0 Then ...
Properties are referenced without using parentheses. To reference the property getter, use this syntax:
xxx = AreaSelected
To access the property setter, use this syntax:
AreaSelected = xxx
精彩评论