- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are tokens in C#?
Token is the smallest element of a program. Let us learn about identifiers and keywords in C# that are tokens −
Keywords
Keywords are reserved words predefined to the C# compiler. These keywords cannot be used as identifiers. However, if you want to use these keywords as identifiers, you may prefix the keyword with the @ character.
The following are some of the reserved keywords in C# −
abstract | As | Base | bool | Break | byte | case |
catch | char | checked | class | Const | continue | decimal |
default | delegate | Do | double | Else | enum | event |
explicit | extern | False | finally | Fixed | float | for |
foreach | goto | If | implicit | In | in (generic modifier) | int |
interface | internal | Is | lock | Long | namespace | new |
null | object | operator | out | out (generic modifier) | override | params |
Identifiers
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.