Skip to content

Instantly share code, notes, and snippets.

@TryJSIL
TryJSIL / tryjsil.cs
Created February 28, 2013 07:51
Simple Unsafe Structs
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 {