The identifier in the programming languages \u200b\u200bis the user element defined by the user. It may be namespace, class, method, variable or interface.
Using identifiers
Identifiers are the characters used for the unique identification of the program element in the code. They are also used to designate types, constants, macros and parameters. The identifier name must specify the value and use of the transmitted element.
Identifier - Compilation Time Object
C # is a compiled programming language that has its own implementation, so identifiers are only compilation time objects. During execution, each identifier reflects the link to the memory address and displays the compiler, according to the designation of its text identifier.
Designation of identifiers
As in C / C ++, C # identifiers are sensitive to the register.
Microsoft recommends using Camel or Pascal designation along with semantics to designate identifiers instead of the Hungarian designation system that was used before programming .NET. For example, "EmployeeSalary" can be the designation of Camel, in which the first letter of all words is capital except for the first word.
The Camel designation system is used to name private members, fields and parameters. "EmployeeSalary" is an identifier in the Pascal designation system, since all words in the identifier begin with the letters of the upper register. It is usually used for names and unprivileged members.
Rules for using identifier
The rules that need to follow when using the identifier include:
- It can only begin with the letter of the alphabet or underscore (_), but not numbers
- This can be a combination of numbers, letters, connectors, a sequence of symbols Unicode, etc.
- It can not be a key word C #
- He should not contain a space
- It cannot contain more than 511 characters.
- It must be announced before its transfer.
- It cannot have two consecutive underscore characters in its name, because such identifiers are used to implement
- You cannot declare more than one identifier with the same name.
The identifier with the prefix "@" is called a literal (verbal) identifier. Although the "@" prefix allows you to use keywords, which helps in collaborating with other programming languages, it is not recommended.