The Primitive Types Available in C#

The list of primitive types available in C# is very similar to C and C++. One of the major reasons for the cross-language interoperability of the .NET Framework is that all languages share a common type system: the CTS. The primitive types in C# are just aliases for CTS types. Table 4-4 shows the primitive types available in C#.

Table 4-4. A Mapping of C# types to CTS types
C# TypesCLS CompliantEquivalent CTS TypeDescription
boolYesSystem.BooleanTrue or false
byteYesSystem.SByteUnsigned 8-bit number
sbyteNoSystem.ByteSigned 8-bit number
charYesSystem.Char16-bit Unicode character
intYesSystem.Int32Signed 32-bit number
uintNoSystem.UInt32Unsigned 32-bit number
longYesSystem.Int64Signed 64-bit number
ulongNoSystem.UInt64 ...

Get .NET and COM Interoperability Handbook, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.