Articles → .NET → Data Types in C#

Data Types in C#










Signed and unsigned numbers









Boolean




Boolean x = false;
bool y = false;



byte and sbyte






















Data TypeMinimum ValueMaximum Value
byte0255
sbyte-128127




byte unsignedByte = 240;
sbyte signedByte = -120;



char














char x = 'A'; // Single character
char y = '\u0041'; // Unicode of 'A'




Data TypeMinimum ValueMaximum Value
char'\u0000''\uffff'





int, long, short, uint, ulong and ushort




Data TypeMinimum ValueMaximum Value
int-2,147,483,6482,147,483,647
long-923,372,036,854,775,8089,223,372,036,854,775,807
short-32,76832,767
uint04,294,967,295
ulong018,446,744,073,709,551,615
ushort065535


int a;
long b;
short c;
uint d;
ulong e;
ushort f;



Decimal, Double and Float




Data TypeSizePrecision
float32-bit7 significant digits
double64-bit15-16 significant digits
decimal128-bit28-29 significant digits






















decimal a = 0.0M;
float b = 0.0F;
double c = 0.0;



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, May 05, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250