O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:  }

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required