Tokens in C#

By
A C# program is a collection of classes.A class is defined by a set of object ,variable and methods.A c# program is basically collection of tokens.
There are five tokens in C#.
  1. Keywords
  2. Identifiers
  3. Literals
  4. operators
  5. punctuators.
     1. ) Keywords:- There are some keywords that are used in c# language which is shown in the Table below:

     2. ) Identifiers:- Identifier is a Name of Classes,Methods,Variables,Labels,Namespace and Interface etc.
There are some Rules with Identifier.
  • Identifiers must not start with a Digit.
  • Identifiers can have alphabets,underscore and digits characters.
  • In Identifiers Upper case and lower case letters are distinct(Ex. hello,HELLO & Hello  are Different with each other).
  • Keywords those are in stand_alone mode can not be used as Identifiers.
      3. ) Literals:-Literals are the way in which the values that stored in variables are represented .There are some types of Literal in C# which is shown in the Table below:
     3.1 ) Integer Literals:- An integer Literal is a sequence  of digits.There are two types of Integers.
  • Decimal Integers:-It consists of a set of digits from 0 to 9 and include minus sign.
         Ex.  141 -151023

Note:- Commas,Embedded space and non digits characters are not permitted b/w digits.
  • Hexadecimal Literals:-A digits that starts with ox or OX is known as Hexadecimal.
     3.2 ) Real Literals:- The Numbers that includes decimal sign is knows as Real Literals.or A   whole number followed by a decimal point and the fraction part is known as Real Literals.
 Ex.
         0.0777 -0.85 2345
         325. -.34 .87
         0.89e5 34e-3 1.3e+5 1.4E2 1.9E-5  
  A floating point Literal may be four types.
  • whole number
  • an exponent
  • fractional part
  • decimal part
     3.3 ) Boolean Literals:- There are two types of Boolean Literal values in c#.
  • true
  • false
     3.4 ) Single character Literals:-A single character Literals contains a single character enclosed within a single quotes(' ').
   Ex.
         'a','8',' ;',' ' etc
     3.5 ) String Literals:-A string Literals is a sequence of characters enclosed within double quotes(" ").
    Ex.
        "HELLO","23","4"."a" etc
     3.6 ) Backslash Character Literals:-There are some backslash character Literals which is shown in the Table below:-


     4. ) Operators:- Operators are symbols that are used to describe operations involving one or more operands. All type of operators i will discuss in Next Tutorials.
     5. ) Punctuators:-Punctuators are the symbols that are used for grouping and separating the code.They define the shape of a program. Punctuators is also known as separators.
Ex.
  • Semicolon(;)
  • colon(:)
  • Comma (,)
  • period (.)
  • parentheses ( )
  • Brackets [ ]
  • Braces { }
To Get the Latest  Free Updates Subscribe
For More:-
  1. Overview of C#
  2. oops
  3. Create a Setup File
  4. E-Post System Project
  5. Method Overloading

3 comments:

  1. Dosta mujhe ye bata ki C# program is a collection of classes or tokens.
    First line me hi confuse kar ke rak diya.

    ReplyDelete
  2. collection of tokens or collection of classes

    ReplyDelete

Powered by Blogger.