In C# data types are categories in the
following types:
Value Type
Reference Type
Pointer Type
Value
type
– Value type variables can be assign a value directly. The following table
shows the value types in c#
| 
   
Type 
 | 
  
   
Represents 
 | 
  
   
Range 
 | 
  
   
Default
  Value 
 | 
 
| 
   
bool 
 | 
  
   
Boolean
  value 
 | 
  
   
True
  or false 
 | 
  
   
False 
 | 
 
| 
   
byte 
 | 
  
   
8-bit
  unsigned integer 
 | 
  
   
0 to
  255 
 | 
  
   
0 
 | 
 
| 
   
char 
 | 
  
   
16-bit
  Unicode character  
 | 
  
   
U
  +0000 to U +ffff 
 | 
  
   
‘\0’ 
 | 
 
| 
   
decimal 
 | 
  
   
128
  bit data type 
 | 
  
   
-1.0
  X 10-7.9X1028 
 | 
  
   
0.0M 
 | 
 
| 
   
double 
 | 
  
   
64
  bit double-precision value 
 | 
  
   
(+/-)5.0
  x 10-324 to (+/-)1.7 x 10308 
 | 
  
   
0.0D 
 | 
 
| 
   
float 
 | 
  
   
32
  bit single precision value 
 | 
  
   
-3.4
  x 1038 to + 3.4 x 1038 
 | 
  
   
0.0F 
 | 
 
| 
   
int 
 | 
  
   
32-bit
  signed integer type 
 | 
  
   
-2,147,483,648
  to 2,147,483,647 
 | 
  
   
0 
 | 
 
| 
   
long 
 | 
  
   
64
  –bit signed integer type 
 | 
  
   
-9,223,372,036,854,775,808
  to 9,223,372,036,854,775,807 
 | 
  
   
0L 
 | 
 
| 
   
sbyte 
 | 
  
   
8-bit
  signed integer type 
 | 
  
   
-128
  to 127 
 | 
  
   
0 
 | 
 
| 
   
short 
 | 
  
   
16-bit
  signed integer type 
 | 
  
   
-32768
  to 32768 
 | 
  
   
0 
 | 
 
Reference
Type
– the reference type do not contain the data directly, while they contain the
reference to the variable. The build-in reference type are : object, and
string.
Object
type
– The object types can be assigned values of any other types, value types,
reference types, when we assign value it need conversion ,conversion of value
type to reference type is called boxing and reference type to value type is
called unboxing.
Obj o;
O=10; this is called boxing
String
Types
- string type assign any string value to a variable 
For Example – string s=”Dot Net
darpan”;
Pointer
type
– pointer type variables store the address of another variable. Syntax of
pointer type is given below:
type* identifier;
For Example – 
Char* dotnet;
int * darpan;
