29.3. Introducing pointers

There are three types in C#: value type, reference type, and the pointer type. Value types and reference types have been thoroughly covered in Chapter 9. Pointer types are only used in unsafe codes.

You will realize that pointer types are, in fact, very similar to reference types with two main differences. Like a pointer type, a reference type does not store the actual object or the values stored in the fields of an object, rather it stores an address to the actual object on the heap.

However, with a reference type you are unable to retrieve the actual address of the object it is referencing. C# shields you from all these low-level issues. You can retrieve the address of an object pointed to by a pointer type though. ...

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.