| [ directory ] |
|
Chapter 9. C# typesObject-oriented purists will argue that C# is 'more OO' than Java in a few ways. One can say that Java is not a pure OO language because it supports primitive types ?and primitive types such as Java's int, long, and double are not real objects. (There is, however, a really good reason for not making your ints and longs objects. [1])
In C#, everything can be treated like an object. Even your ints, chars, and longs ?primitive types in C# (primitive types are known officially as 'simple types') ?are also subclasses of System.Object together with all other C# classes. Java types are grouped into two main categories:
In C#, all types are categorized into three groups:
Table 9.1 shows a brief comparison between types in Java and C#. More detailed information about C# types follows.
Figure 9.1 shows how C# types are categorized. Figure 9.1. C# type categorization. The shaded boxes are C# keywords. Besides object and string (which are aliases for System.Object and System.String, respectively), the other shaded boxes are simple value types.
|
| [ directory ] |
|