Primitive types
Core provides fixed-width numeric types, target-sized integers, C-compatible long integers, booleans and void.
Integer types
| Type | Signed | Width |
|---|---|---|
byte | No | 8-bit |
sbyte | Yes | 8-bit |
short | Yes | 16-bit |
ushort | No | 16-bit |
int | Yes | 32-bit |
uint | No | 32-bit |
long | Yes | 64-bit |
ulong | No | 64-bit |
Target-sized integers
nint and nuint match the target pointer width. They are useful for native addresses, allocation sizes and offsets.
clong and culong match the selected platform's C ABI definition of long and unsigned long.
nuint size = 4096;
clong nativeResult = 0;
Floating-point and boolean types
float is IEEE-754 binary32 and double is IEEE-754 binary64. Conditions use the dedicated bool type and the values true and false.
float speed = 5.0f;
double elapsed = 10.5;
bool running = true;
void describes a function with no return value and also forms the untyped pointer void*.