C# Identifiers Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In programming languages, identifiers are used for identification purposes. Or in other words, identifiers are the user-defined name of the program components. In C#, an identifier can be a class name, method name, variable name, or label. Example: public class GFG { static public void Main () { int x; }}Here the total number of identifiers present in the above example is 3 and the names of these identifiers are: GFG: Name of the classMain: Method namex: Variable nameRules for Defining IdentifiersThere are certain valid rules for defining a valid C# identifier. These rules should be followed, otherwise, we will get a compile-time error. AspectDescriptionAllowed CharactersThe only allowed characters for identifiers are all alphanumeric characters([A-Z], [a-z], [0-9]), '_' (underscore). For example, "geek@" is not a valid C# identifier as it contain '@' – special character.Starting CharacterIdentifiers should not start with digits([0-9]). For example, "123geeks" is not valid in the C# identifier.No WhitespacesIdentifiers must not contain whitespace characters.KeywordsIdentifiers are not allowed to use as keywords unless they include @ as a prefix. For example, @as is a valid identifier, but "as" is not because it is a keyword.Unicode SupportC# identifiers allow Unicode Characters.Case - SensitivityC# identifiers are case-sensitive.Length RestrictionC# identifiers cannot contain more than 512 characters.No Double UnderscoresIdentifiers do not contain two consecutive underscores in their name because such types of identifiers are used for the implementation.Example: C# // Simple C# program to illustrate identifiers using System; class Geeks { // Main Method static public void Main() { // variable int a = 10; int b = 39; int c; // basic operation c = a + b; Console.WriteLine("The sum of two number is: {0}", c); } } OutputThe sum of two number is: 49 Below data shows the identifiers and keywords present in the above example:Keywords: using, public, static, void, int.Identifiers: Geeks, Main , a, b, c. Comment More infoAdvertise with us A ankita_saini Follow Improve Article Tags : Misc C# CSharp-Basics Explore IntroductionC# Tutorial 4 min read Introduction to .NET Framework 6 min read C# .NET Framework (Basic Architecture and Component Stack) 6 min read C# Hello World 2 min read Common Language Runtime (CLR) in C# 4 min read FundamentalsC# Identifiers 2 min read Data Types in C# 6 min read C# Variables 4 min read C# Literals 5 min read Operators in C# 7 min read C# Keywords 5 min read Control StatementsC# Decision Making (if, if-else, if-else-if ladder, nested if, switch, nested switch) 5 min read C# Switch Statement 4 min read Loops in C# 4 min read C# Jump Statements (Break, Continue, Goto, Return and Throw) 4 min read OOP ConceptsC# Class and Objects 5 min read C# Constructors 5 min read C# Inheritance 6 min read C# Encapsulation 4 min read C# Abstraction 4 min read MethodsMethods in C# 4 min read Method Overloading in C# 4 min read C# | Method Parameters 7 min read C# Method Overriding 9 min read Anonymous Method in C# 3 min read ArraysArrays in C# 6 min read Jagged Arrays in C# 4 min read Array Class in C# 5 min read How to Sort an Array in C# | Array.Sort() Method Set - 1 8 min read How to find the rank of an array in C# 2 min read ArrayListArrayList in C# 6 min read C# ArrayList Class 7 min read C# | Array vs ArrayList 2 min read StringStrings in C# 6 min read C# Verbatim String Literal - @ 5 min read C# String Class 9 min read C# StringBuilder 4 min read C# String vs StringBuilder 3 min read TupleC# Tuple 7 min read C# Tuple Class 3 min read C# ValueTuple 7 min read C# ValueTuple Struct 4 min read IndexersC# Indexers 4 min read C# Multidimensional Indexers 5 min read C# - Overloading of Indexers 3 min read Like