Data Types

An important part in the life of a C# programmer is the management of data types. Just as in C and C++, every variable has a fixed data type. Every data type provides a rich set of operators that can be used to perform a very special operation. Objects can be seen as data types as well, but we'll take a closer look at that later in this book.

Predefined Data Types

C# supports a list of predefined data types. In this section, we examine the most important types. Table 3.1 contains an overview.

Table 3.1. Predefined Data Types
sbyteSystem.SbyteYes1 byte–128 to 127
shortSystem.Int16Yes2 bytes–32768 to 32767
intSystem.Int32Yes4 bytes–2147483648 to 2147483647
longSystem.Int64Yes8 bytes–9223372036854775808 to 9223372036854775807 ...

Get Mono Kick Start now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.