This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
public static class Program { | |
public static unsafe void Main (string[] args) { | |
var bytes = new byte[8]; | |
fixed (byte* pBytes = bytes) { | |
var pStruct = (MyStruct*)pBytes; | |
*pStruct = new MyStruct { |