mdibb.net

C# Data Types

Below is a table showing the minium and maximum values (i.e. the range) of the most common data types in C#. These values are based on those found in the MSDN docs. In MSDN some of these values are kinda spread out in various different pages so I've put them together into a single table for easy comparison as I've found the MSDN site pretty slow to browse sometimes.



.NET Type Integral Type Range Size
System.Byte byte 0 to 255 unsigned 8bit integer
System.SByte sbyte -128 to 127 signed 8bit integer
System.Char char U+0000 to U+ffff unicode 16-bit character
System.Int16 short -32,768 to 32,767 signed 16-bit integer
System.UInt16 ushort 0 to 65,535 unsigned 16-bit integer
System.Int32 int -2,147,483,648 to 2,147,483,647 signed 32-bit integer
System.UInt32 uint 0 to 4,294,967,295 unsigned 32-bit integer
System.Int64 long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 signed 64-bit integer
System.UInt64 ulong 0 to 18,446,744,073,709,551,615 unsigned 64-bit integer
System.Single float ±1.5 × 10-45 to ±3.4 × 1038 (approx.) 7 digit precision
System.Double double ±5.0 × 10-324 to ±1.7 × 10308 (approx.) 15-16 digit precision
System.Decimal decimal ±1.0 × 10e-28 to ±7.9 × 10e28 (approx.) 28-29 significant digits

Back 29.05.2006.