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

1.9. Unsafe codes and real time programs

.NET literature uses the term 'unsafe code' to refer to code which involves pointer operations. [44] Only certain .NET languages, including C# and Visual C++ .NET, support unsafe coding. [45]

[44] C/C++ programmers will be familiar with pointers (and the bugs they often bring). As for Java programmers, pointers (or, more accurately, pointer variables) are just variables which contain the memory addresses of another variable.

[45] In C#, unsafe codes must be used within code blocks marked with the unsafe keyword.

Using pointer operations, you can perform some tweaking to optimize your codes. A good example is implementing your array 'object' on the stack (like Java, arrays are objects in the various .NET ...

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