C# Professional - Numbers

talent-agile
68.1K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Next: Arithmetic overflow

Numeric types in C#

C# offers multiple numeric types, for integer data types and non-integer data types.

Integer Data Types

TypeDescriptionMinimum ValueMaximum Value
byteUnsigned byte0255
sbyteSigned byte-128127
shortSigned byte-32 76832 767
ushortUnsigned byte065 535
intSigned byte-2 147 483 6482 147 483 647
uintUnsigned byte04 294 967 295
longSigned byte-9x1089x108
ulongUnsigned byte01,8x1019

Non-integer Data Types

All non-integer data types are signed.

TypeDescriptionScalePrecision
floatSingle Precision Number±1.5x10-45 to ±3.4x10387 digits
doubleDouble Precision Number±5x10-324 to ±1.7x1030815 or 16 digits
decimalDecimal Number±10-28 to ±7.9x102828 or 29 digits
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content