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#.
C# Types | CLS Compliant | Equivalent CTS Type | Description |
---|---|---|---|
bool | Yes | System.Boolean | True or false |
byte | Yes | System.SByte | Unsigned 8-bit number |
sbyte | No | System.Byte | Signed 8-bit number |
char | Yes | System.Char | 16-bit Unicode character |
int | Yes | System.Int32 | Signed 32-bit number |
uint | No | System.UInt32 | Unsigned 32-bit number |
long | Yes | System.Int64 | Signed 64-bit number |
ulong | No | System.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.