To name the variables of your program, you must follow strict rules. In fact, everything else in your program must have a name. C# uses a series of words, called keywords, for its internal use. This means that you must avoid naming your objects using one of these keywords. They are:
abstract | const | extern | int | out | short | typeof |
as | continue | false | interface | override | sizeof | uint |
base | decimal | finally | internal | params | stackalloc | ulong |
bool | default | fixed | is | private | static | unchecked |
break | delegate | float | lock | protected | string | unsafe |
byte | do | for | long | public | struct | ushort |
case | double | foreach | namespace | readonly | switch | using |
catch | else | goto | new | ref | this | virtual |
char | enum | if | null | return | throw | void |
checked | event | implicit | object | sbyte | true | volatile |
class | explicit | in | operator | sealed | try | while |
Besides these keywords, C# has other words that should be reserved only depending on how and where they are used. These are referred to as contextual keywords and they are:
Once you avoid these words, there are rules you must follow when naming your objects. On this site, here are the rules we will follow:
Besides these rules, you can also create your own but that abide by the above. C# is case-sensitive. This means that the names Case, case, and CASE are completely different. For example, main is always written Main. |