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

9.2. Reference types

Reference types in C# are identical to Java reference types – they refer to objects on the heap. You can skip to the next section if you are already clear about Java reference types – I have included the following paragraphs just to make the text more complete.

Like Java, and unlike C/C++, C# reference types are type-safe, meaning that it is impossible for a reference type variable to refer to some unallocated or random memory space which you can corrupt. Such type-safety means that a C# application cannot corrupt memory which has not been allocated for that application running on the Windows operating system (which supports multi-programming). The only way a C# program can access memory locations directly is via pointer ...

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