Monday, June 28, 2010

What are Properties in .Net

Properties are used to expose the values of fields.
! It is like an extension of member variable, where we can check value of variable.
! A property is a member of a class. It behaves like a variable for the user.
! To implement a property in real life, we create a public variable which will hold the value of the property.
! When there is only get accessor, it behaves as const / read only field.
! When there is only set accessor, it behaves as write only field.
! Like variable we access them using the class and not the instance.
! Property or Indexer cannot be of void type.
! Properties can be overridden but not overloaded.

0 comments:

Post a Comment