What are identifiers in C#?

CsharpProgrammingServer Side Programming

An identifier is a name used to identify a class, variable, function, or any other user-defined item. The basic rules for naming classes in C# are as follows −

  • A name must begin with a letter that could be followed by a sequence of letters, digits (0 - 9) or underscore. The first character in an identifier cannot be a digit.

  • It must not contain any embedded space or symbol such as? - + ! @ # % ^ & * ( ) [ ] { } . ; : " ' / and \. However, an underscore ( _ ) can be used.

  • It should not be a C# keyword.

The following are some examples of identifiers −

Class Names

class Calculation
class Demo

Valid Functions Names

void display()
void getMarks()

Variable Names

int a;
int marks;
int rank;
double res_marks;
raja
Published on 10-Aug-2018 14:39:07
Advertisements