Although pointers are not normally available in C#, developers can choose to use pointers at their discretion. Pointers are available in the context of unsafe code, which requires the unsafe keyword. You can create pointers to unmanaged types, such as the int, float, and char types. In addition, unsafe code must be compiled with the unsafe compiler option.
You cannot create pointers to moveable memory. Managed memory is moveable and managed by the garbage collector (GC). The fixed statement pins managed memory within a block. Pinned memory is fixed. While pinned, memory is not accessible to the GC.
The DllImportAttribute, which describes an unmanaged function that is exported from a library, has various options to configure the importing of a function. The Interop marshaler marshals parameters and returns values between managed and unmanaged memory during the function call. Blittable types do not require conversion. Nonblittable types require conversion to unmanaged memory. Developers can explicitly marshal nonblittable types using the MarshalAs attribute.