Skip to content

Instantly share code, notes, and snippets.

@sayurin
Created December 7, 2013 02:38
Show Gist options
  • Save sayurin/7836635 to your computer and use it in GitHub Desktop.
Save sayurin/7836635 to your computer and use it in GitHub Desktop.
あんまり速くなかった…
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Linq" #>
<#@ output extension=".cs" #>
using System.Reflection;
class UnsafePoh {
static readonly byte[] bytes = new byte[]{
<#= string.Join(Environment.NewLine, File.ReadAllBytes(Host.ResolvePath("Unsafe.dll")).Select((b, i) => new { b, i }).GroupBy(a => a.i / 16, a => string.Format("0x{0:X2}, ", a.b), (_, g) => string.Concat(g))) #>
};
static void Main() {
Assembly.Load(bytes).GetType("Unsafe").InvokeMember("Main", BindingFlags.Public|BindingFlags.Static|BindingFlags.InvokeMethod, null, null, null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment