Home > DeveloperSection > Blogs > Identifiers in c#

Identifiers in c#

C# C# 
3 Comment(s)
 10553  View(s)
Rate this:

Identifiers in c#

Identifiers are tokens or symbols which are uniquely identify the element. They are names of things like variables or fields. Identifiers are names given to namespaces, classes, methods, variables, and interfaces etc. Identifiers in c# are case sensitive. For example abc is not equal to ABC. Identifiers can be combination of letters, numbers, and underscores. Keywords are not defined as identifiers. It can make the identifiers by using Unicode character as “@”.

For example

int @int=10;


Valid identifiers in C# are following this rule

·         An identifier must start with a letter or an underscore.

·         After the first character, it may contain numbers, letters, connectors, etc.

·          If the identifier is a keyword, it must be prep ended with “@” .

For Example:

The following names are valid identifiers in C#:

1.       WORLD

2.       world

3.       w_orld

4.       HelloWorld

5.       Z

6.       Z

7.       \u098world

8.       @public

9.       _world

And some invalid identifiers

1.       2world  //error because first letter is number

2.       Public  //error because it is keyword

3.       \u0027format // error because Unicode formatting character


By John Smith on   6 years ago
Good one..

C# Identifiers

By Gym Prathap on   2 years ago
C# follows The Unicode Standard, Version 3.0 rules except the Underscore

Limitations in C

By Anu Priya on   2 years ago
Well, C has a certain limitation in its character. When 32 character exceeds, it will be ignored by the compiler.

Don't want to miss updates? Please click the below button!

Follow MindStick