C.5 Naming C properties


C.5 Naming C# properties

If you choose to use the same name for a public or protected property which 'represents' a private field in a C# class, they should be differentiated by capitalization. The public/protected property name should use Pascal casing, while the private field should use camel casing . Here is an example:

 1:  private string  name  ; // private field name  2:  3:  public string  Name  { // property Name  4:    get{  5:      return name;  6:    }  7:    set {  8:      name = value;  9:    } 10:  } 


From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net