Identifiers in C#
Identifiers in C# Programming Language:
Identifier is a sequence of characters; which help us to identify specific part of a program.
Identifiers are names given to the program elements by the programmers. Hence they are also called programmer defined names or user defined names.
name of a variable
name of a constant
name of an array
name of a method
name of a structure
name of a class
name of an object
name of an interface
name of a namespace
Naming conventions: are the rules or guidelines for writing identifiers
1. Identifiers should be meaningful and descriptive.
2. Keywords should not be used as identifiers.
3. First character of an identifier must be an alphabet or underscore.
4. First character should not be a digit or a number.
5. All succeeding characters can be alphabets, digits, or underscores.
6. Except an underscore no other special characters are allowed, not even space.
7. More than one successive underscores should not be written
8. Identifiers should be unique in a scope.
9. Identifiers are case sensitive.
Variable Names: s, p, Num, num, score, _flag, player9, price, playerHealth, etc.
Constant Names: SCREEN_WIDTH, SCREEN_HEIGHT, etc.
Method Names: SetWidth(), SetHeight(), etc.
Structure, Class, Namespace names: Student, MathLibrary etc.
Interface names: IDamagiable, IFlyable, IDamagiable etc.
9thplayer, a$b, _ _flag, player health, continue, while, break, etc.