Integer Standard Types

Integers are used to represent numerical values without decimals or fractional parts. Elements provides eight different integer types – four difference sizes (8, 16, 32 and 64 bits), both signed (i.e. able to contain positive and negative values) and unsigned (i.e. restricted to contain only zero and positive values).

All integer types, along with their aliases, are defined in the RemObjects.Elements.System namespace – which is in scope by default and does not have to be used/imported manually. However, the namespace name can be used to prefix the type names, where necessary, to avoid ambiguities.

In addition to the main names and their aliases listed below, C# also provides keywords (such as int) to refer to these same types. Swift also defines additional aliases in the Swift namespace via the Swift Base Library.

Probably the most commonly used integer type is Integer, a.k.a. Int32 or int.

Name Description Aliases C# Keyword Swift Aliases
Byte An 8 bits unsigned integer byte UInt8
SByte An 8 bits signed integer ShortInt Int8
UInt16 A 16 bits unsigned integer Word    
Int16 A 16 bits signed integer SmallInt    
UInt32 A 32 bits unsigned integer Cardinal, LongWord    
Int32 A 32 bits signed integer Integer int  
UInt64 A 64 bits unsigned integer UIntMax
Int64 A 64 bits signed integer long IntMax
NativeUInt A platform-sized unsigned integer1 UIntPtr UInt
NativeInt A platform-sized signed integer[^1] IntPtr Int

See Also

  1. The "native" sized types are 32-bits when targeting a 32-bit CPU and 64-bits on a 64-bit CPU. On .NET, this means the type's size changes dynamically based on where your application runs. On Cocoa, the type's size is determined at compile time (but remember that the same application may be compiled to both 32 and 64 bits at the same time). Note that native integers are not supported on the Java platform.