O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required