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.1. General naming conventions

The casing conventions for C# are shown in Table C.2

Table C.2. Casing conventions for C#
CategoryCasing
Local variablesCamel casing
Parameters passed into methods (considered local variables)Camel casing
All other identifiers (names of namespaces, classes, interfaces, all class members)Pascal casing

This implies that your method and field names should use Pascal casing, like your classes. In C#, camel casing should be reserved only for local variables. [2]

[2] This is very different from Java's naming conventions. Java advocates that all class and interface identifiers should use Pascal casing, and all other identifiers use camel casing. C# says that all identifiers should use Pascal casing, except for local variables ...

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