Mega Code Archive

 
Categories / C# Tutorial / Class
 

Properties and its Restrictions

A property consists of a name along with get and set accessors. The accessors are used to get and set the value of a variable. The general form of a property is shown here: type propertyName {         get {             // get accessor code         }                  set {             // set accessor code         }     } A property cannot be passed as a ref or out parameter to a method. You cannot overload a property. A property should not alter the state of the underlying variable when the get accessor is called. (Quote from C# The Complete Reference, Publisher: Osborne/McGraw-Hill, March 8, 2002, Language: English ISBN-10: 0072134852 ISBN-13: 978-0072134858)