Tuesday, May 8, 2012

DataTypes in C#.NET

 DataTypes in C#.NET:-
 
All the data types in .net are available within the namespace System and are as follows.

 Category  Class/Structre Name Data Type in C#.NET  NO. of Bytes   Range
 Integer  System.Byte  Byte  1(Unsigned)  0 to 255
   System.SByte  Sbyte  1(Signed)  -128 to 127
   System.Int16  Short  2(Signed)  -32,768 to 32,767
   System.Uint16  Ushort  2(Unsigned)  0 to 65,535
   System.Int32  Int  4(Signed)  -2,147,483,648 to 2,147,483,647
   System.Uint32  Uint  4(Unsigned)  0 to 4,294,967,295
   System.Int64  Long  8(Signed)  -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
   System.Uint64  Ulong  8(Unsigned)  0 to 18,446,744,073,709,551,615
 Float        
   Single  Float  4  ±1.5e−45 to ±3.4e38 
(Precision:7 digits)
   Double  Double  8  ±5.0e−324 to ±1.7e308
(Precision:15-16 digits)
   Decimal  Decimal  16  (-7.9 x 1028 to 7.9 x 1028) / (100 to 28)
(Precision:28-29 digits)
 Character        
   Char  Char  2  
   String  String  size varies  
 Other        
   DateTime  DateTime  8  
   Boolean  Bool  1  
   Object  Object  size varies  Can store any type of value


Note: Of all the datatypes, string and object are reference types while all other are value types.

0 comments: