Information Technology Reference
In-Depth Information
Predefined Types
C# provides 15 predefined types, which are shown in Figure 3-4 and listed in Tables 3-1 and
3-2. They include 13 simple types and 2 non-simple types.
The names of all the predefined types consist of all lowercase characters. The predefined
simple types include the following:
￿
11 numeric types, including
-
Various lengths of signed and unsigned integer types.
Floating point types— float and double .
-
A high-precision decimal type called decimal . Unlike float and double , type decimal
can represent decimal fractional numbers exactly. It is often used for monetary
calculations.
-
A Unicode character type, called char .
￿
A Boolean type, called bool . Type bool represents Boolean values and must be one of two
values—either true or false .
￿
Note Unlike C and C++, numeric values do not have a Boolean interpretation in C#.
The two non-simple types are the following:
￿Type string , which is a sequence of Unicode characters.
￿Type object , which is the type on which all other types are based.
Figure 3-4. The predefined types
Search WWH ::




Custom Search