Saturday, March 31, 2012

Set and Get

Hi everyone
i am working in .net since a while and i read a book for starting.
the problem is that i read on the internet a lot of examples using Set and Get method but really i didn't understand the meaning of it.
i did 2 web projects and i didn't use Get or Set.

in fact i didn't use this :
Public Property Text() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

I have never define a property, i am defining a variable or a function
for example if i need a variable i put:
dim str as string
and then i give it a value.

which situation i really need to define a property
thanks.Hi,
You should use properties to add additional processing on field access. You can, for example, perform validation before assigment or check user permissions and format data on read access.

0 comments:

Post a Comment