Tuesday, July 14, 2009

How can I use pointers in C#.net?

What is unsafe mode?

How can I use pointers in C#.net?
You can use pointers just like in C++ although it is use is rare( perhaps only for dealing with older API's with Win32).





You can reference memory directly, add addresses, pass by reference etc.





All operations with pointers need to be within unsafe mode blocks. Pointer operations are dangerous because you can modify or delete memory of other variable/space, for this the compiler requires you to mark areas where you use them as unsafe.








The best explanation you can find in MSDN.


No comments:

Post a Comment