No one C# naming convention has dominated development.
A few of the major forms are All-caps, Camel Casing, C-casing, Pascal Casing and Hungarian.
In fact Microsoft recommends a mixture of these in development. Although it is clear that at this point Hungarian and All-caps are out of favor with most developers.
All-caps is the upper casing of every letter or using all capital letters. This holds on in the naming of constants or objects that are considered non moving.
Camel Casing has compound names using capital letters for the first letter and lower case for the rest with the exception of the very first letter. So if a variable is for a "file handle" it would be named "fileHandle". The memory device for this is to think the camel has the high point in the middle.
C-casing which is also called Underscore separation has the compound names joined with underscores; so "file handle" would be "file_handle".
Pascal Casing which takes it's name from the language Pascal where it became dominant has compound names using capital first letters for each part; as in "file handle"becomes "FileHandle".
Hungarian which became dominant in Visual C++ and Visual Basic and is in disfavor now is harder to formulate because there are many variations. It is my belief it has died of the weight of all the variations. Some key features of all variations is the prefixing of a single lowercase letter to indicate type. If the "file handle" was of type Handle it would be "hFile". Another common feature is to prefix this with "m_" to indicate class level scope.
No comments:
Post a Comment