Integral Types

Integral types are one category of built-in value types. They have an integral numeric value represented by a number of bits (not surprisingly in powers of two) and can either be signed or unsigned.

The u prefix is typically used as a prefix in the C# reserved word for those types to denote unsigned integral types. A notable exception is byte, which is unsigned, where an s prefix is used to indicate the signed variant. This aligns with what developers spontaneously think of when you say “byte” (range 0x00 to 0xFF to say it in hex). And the English pronunciation of “ubyte” didn’t sound too appealing either! Table 4.1 summarizes the integral types with their C# and BCL names, along with their ranges.

Table 4.1. Integral Types

Get C# 4.0 Unleashed 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.