Using unsafe and fixed : unsafe « unsafe « C# / CSharp Tutorial

  1. Any code that uses pointers must be marked as unsafe by using the unsafe keyword.
  2. You can mark an individual statement or an entire method unsafe.
  1. The fixed modifier is often used when working with pointers.
  2. The fixed modifier prevents a managed variable from being moved by the garbage collector.

36.1.1.Unsafe Code
36.1.2.Compile unsafe code
36.1.3.Using unsafe and fixed
36.1.4.Mark method as unsafe to pointers
36.1.5.Accessing Structure Members with a Pointer
36.1.6.Unsafe Methods
36.1.7.Using the unsafe keyword.
36.1.8.unsafe block