An identifier is any name that you choose to use in a C# program for things like: variables, classes, interfaces, methods, properties, etc.
The rules for naming identifiers include:
- They are case sensitive (i.e. “name” is different from “Name”)
- They must begin with a letter or underscore (‘_’)
- They cannot include spaces
- They can include Unicode characters
- They cannot match any of the built-in C# keywords
You can actually name an identifier with a name matching a built-in keyword if you prefix the identifer with the ‘@’ symbol. In the following example, we declare a variable of type string and name the variable “string”. This is legal in C#, but not a good practice.
1
| string @ string = "Don't do this" ; |