C Sharp Data Types - chrisbitm/python GitHub Wiki

In C#, data types are broadly categorized into Value Types, Reference Types, Pointer Types, and Nullable Types.

Value Types

Whole Numbers

Type Size Range
byte 8-bit 0 to 255
sbyte 8-bit -128 to 127
short 16-bit -32,768 to 32,767
ushort 16-bit 0 to 65,535
int 32-bit -2,147,483,648 to 2,147,483,647
uint 32-bit 0 to 4,294,967,295
long 64-bit Very large range
ulong 64-bit 0 to very large number

Floating Point Numbers

Type Size Precision
float 32-bit ~7 digits
double 64-bit ~15-16 digits
decimal 128-bit ~28-29 digits (higher precision, used for financial calcs)

Other value types char – 16-bit Unicode character

bool – true or false

enum – User-defined enumeration

struct – User-defined value type

Reference Types

Refrerence Types refer to strings, classes objects arrays etc.