All data types in .NET are implemented as classes within the
System namespace. One such data type is
System.Byte, which implements an 8-bit integer value, just like we discussed earlier. It holds integer values from 0 to 255. These values are always stored using 8 bits of binary data, but they magically appear in decimal form whenever you ask them to be presented.
The .NET Framework includes 15 core interpretive data types: 8 for integers, 3 for decimal numbers, 2 for character data, a combined data type for dates and times, and a Boolean data type.
Based on the number of available data types (8 out of the 15 core types), you would think that most programmers worked with integers all day long—and you'd be right. Whether it's actual user data or loop counters or status codes or the storage method for enumerated data types, integers show up everywhere in .NET code.
The range of values for an integer data type depends directly on the number of binary digits managed by that data type; the more digits, the bigger the range. Also, half of the integer data types store both positive and negative values (called "signed" integers), whereas the other half support only positive numbers ("unsigned"). Table 6-1 lists the eight integer data types included with .NET, and their associated ranges.
Table 6-1. Integer data types in .NET
.NET data type
Range of values