O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

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

Chapter 22. C# Naming and Coding Conventions

Naming conventions have long been understood to be a beneficial practice in software development, for a variety of reasons elucidated more clearly and persuasively elsewhere. The benefits of a naming convention, however, take special meaning in the cross-language environment that .NET offers — for the first time, a class library written in C# can be accessed verbatim from VB, C++, Eiffel, and any other “.NET-consumer” language, compiler, or environment. While “industry practices” are hard to discuss in an industry that has yet to even ship its first release, Microsoft has released some guidelines to its own naming conventions, used predominantly in the Framework Class Library; even if you and your development shop choose to use alternative conventions, understanding the naming conventions of the FCL is key to using it effectively.

There are three elements of naming guidelines:

  • Case (capitalization)

  • Mechanics (class names, method names, and so on)

  • Word choice (consistent terminology and phraseology)

Much of this information can also be found in the Microsoft documentation set.

Case

Throughout the years, computer scientists have never been able to agree on one common way in which to express human-readable concepts (including word breaks for compound names such as “XML reader” or “input stream”) in arenas in which normal rules of English, such as spaces, cannot apply. As a result, various languages have used different rules and formats to indicate ...

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