Thursday, February 28, 2008

Naming Variables .NET Framework style

i was reading a book where i found this. Naming a variable is an important thing so always give a variable an easy and a readable name. Following text is taken from a Microsoft Visual C# .NET Step by Step.

  • Don’t use underscores.

  • Don’t create identifiers that differ only by case. For example, do not create one variable named myVariable and another named MyVariable for use at the same time.

  • Start the name with a lowercase letter.

  • In a multiword identifier, start the second and each subsequent word with an uppercase letter. (This is called camelCase notation.)

  • Don’t use Hungarian notation. (Microsoft Visual C++ developers reading this book are probably familiar with Hungarian notation. If you don’t know what Hungarian notation is, don’t worry about it!)


The first two recommendations as compulsory because they relate to Common Language Specification (CLS) compliance. If you want to write programs that can interoperate with other languages, such as Microsoft Visual Basic .NET, you need to comply with these recommendations.

In coming days i will write some more things about .NEt and other languages.

Byeeeee

No comments: