[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World


Definition - What does Identifier mean?

An identifier, in C#, is the user-defined name of a program element. It can be a namespace, class, method, variable or interface.

Identifiers are symbols used to uniquely identify a program element in the code. They are also used to refer to types, constants, macros and parameters. An identifier name should indicate the meaning and usage of the element being referred.

C# is a programming language that is compiled and has its implementation such that the identifiers are only compile-time entities. During run time, each identifier will be referred by its reference to the memory address and offset the compiler assigned to its textual identifier token.

Techopedia explains Identifier

Like in C/C++, identifiers in C# are case-sensitive.

Microsoft recommends the use of Camel or Pascal notations, along with semantics, for naming identifiers instead of the Hungarian notation that was used prior to .NET programming. For example, "employeeSalary" might represent Camel notation wherein the first letter of all the words is capitalized except the first word. Camel notation is used to name private members, fields and parameters. "EmployeeSalary" is an identifier in Pascal notation, as all the words in the identifier begin with an upper-case letter. It is usually used for type names and nonprivate members of a type.

The rules to be followed while using an identifier include:

  • It can start only with a letter of the alphabet or underscore(_), but not a number
  • It can be a combination of numbers, letters, connectors, Unicode escape sequence, etc.
  • It cannot be a C# keyword
  • It should not contain white space
  • It cannot have more than 511 characters
  • It has to be declared before it is referred
  • It cannot have two consecutive underscores in its name because such identifiers are used for the implementation
  • More than one identifier with the same name cannot be declared within a single scope

An identifier prefixed with "@" is called a verbatim identifier. Although prefixing "@" allows for the use of keywords, which helps in interfacing with other programming languages, it is not a recommended practice.

This definition was written in the context of C#

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.