Programming Fundamentals for Beginners

Primitive Types and Variables

Integral Types Table

C# Type .NET Framework Type Size [bytes] Size [bits] Signed Range Suffix Default
byte System.Byte 1 8 no 0 to 255 0
sbyte System.SByte 1 8 yes -128 to 127 0
char System.Char 2 16 no U+0000 to U+ffff '\0'
short System.Int16 2 16 yes -32,768 to 32,767 0
ushort System.UInt16 2 16 no 0 to 65,535 0
int System.Int32 4 32 yes -2,147,483,648 to 2,147,483,647 0
uint System.UInt32 4 32 no 0 to 4,294,967,295 U or u 0
long System.Int64 8 64 yes -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 L or l 0L
ulong System.UInt64 8 64 no 0 to 18,446,744,073,709,551,615 UL or ul 0

Floating-Point Types Table

C# Type .NET Framework Type Size [bytes] Size [bits] Signed Range Precision Suffix Default
float System.Single 4 32 yes ±1.5e-45 to ±3.4e38 7 digits F or f 0.0F
double System.Double 8 64 yes ±5.0e-324 to ±1.7e308 15-16 digits D or d 0.0D

Decimal Type Table

C# Type .NET Framework Type Size [bytes] Size [bits] Signed Range Precision Suffix Default
decimal System.Decimal 16 128 yes ±1.0e-28 to ±7.9e28 28-29 significant digits M or m 0.0M

Boolean Type Table

C# Type .NET Framework Type Size [bytes] Size [bits] Range Default
bool System.Boolean 1 8 true or false false