public byte[] ExportLocalizationMap() { object error; IntPtr rawDataBuffer = NativeMethods.rs2_export_localization_map(Handle, out error); IntPtr start = NativeMethods.rs2_get_raw_data(rawDataBuffer, out error); int size = NativeMethods.rs2_get_raw_data_size(rawDataBuffer, out error); byte[] managedBytes = new byte[size]; Marshal.Copy(start, managedBytes, 0, size); NativeMethods.rs2_delete_raw_data(rawDataBuffer); return(managedBytes); }