Chapter 9. C# types

Object-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])

[1] Instantiating objects is an expensive process. When you want to perform a simple arithmetic addition, you want to perform the operation on the stack quickly and efficiently. Some programming languages do not have primitives; even integers are represented as objects. When two integers are to be added, two integer objects are actually created in the heap. The process is wasteful if all you want ...

Get From Java to C#: A Developer's Guide now with O’Reilly online learning.

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