You are on page 1of 5

Sri Ganeshaye Namah:

Identifier and Keywords.


Keywords are the reserved words whose meaning is predefined to C# compiler. In other words are
those words, which are reserved by the C# compiler to be used for specific task.
We cannot use keywords as variable, methods and properties because they are already defined to
the compiler to perform specific functionalities.
If you want to use the keywords as identifiers, prefix the keyword with @ character. C# provides
some identifiers having special meaning in the context of code such as get and set, but they are not
reserved keywords. These identifiers are known as contextual keywords.
Keywords table for C#. Table
Reserve Keywords

Contextual Keywords

Data Types, Variables and Constants.

C# supports a rich and varied slection of data types from built-in types, such as integers or strings, to
userdefined types, such as enumerations, structures and classes.
Some Important Point.
All variable whether user defined pr instrinsic (built-in), can be used as objects anywhere in a
program.
All variables in a program are automatically initialized to default values by the system when they are
declared.
In C# datatype are categorized into three simple organizational structures. Value types
Reference types
Pointer types
Notes:
Pointer types in C# offer the same capabilities as offered by C and C++ language. both, pointers and
references represent memory address but the difference is that references are tracked by the

garbage collector and pointer are not. Also, we can perform arithmetic operations on pointers but
not in references.
Variable and constant deal with the data values and memory locations.
The variable is the memory location whose size depends on the data type.
The memory reserved for the variables of different data type are different.
Constants are the fixed values assigned to a constant variable. These values remain unchanged
throughout the execution of the program.

Value Type:
Value types allow you to store the data directly into the variable. They are derived from
System.ValueType and have a special hehavior in CLR.
The value types and their cantent are stored at the same location in memory.
The default values of value types are stored on stack.
Value type
bool
byte
char
decimal
double
float
int long
sbyte
short
uint
ulong
ushort

Ranges
True or False
0 to 255
U+0000 to U+ffff

-128 to 127
-32,768 to 32,767
0 to 4,294,976,295
0 to
18,446,744,073,709,551,615
0 to 65,535

The value types are divided into the following categories:


Struct type
Enum type

False
\0

0
0
0
0
0

Struct types are divided into the following five categories:

1.
2.
3.
4.
5.

Integral type
Floating Point type
Decimal type
Bollean type
Nullable type

Enumeration Type:

Reference Types:
Predefined Reference types
1. Dynamic type
2. Object type
3. String type
User-defined Reference Types
1.
2.
3.
4.

Classes
Interfaces
Delegates
Arrays

Pointer Types

Type Conversion:
Implicit Conversion
Explicit Conversion/Type Cating

Boxing and Unboxing

Variables
Constants
Expression and Operators
Operator Precedence
Using the ?? (Null Coalescing) Operator
Using the :: Scope Resolution Operator
Using the is and as Operator

Sri Ganeshaye Namah:


Pointer types in C# offer the same capabilities as offered by C and C++ language. both, pointers and
references represent memory address but the difference is that references are tracked by the
garbage collector and pointer are not. Also, we can perform arithmetic operations on pointers but
not in references.

You might also like