Skip to content

Instantly share code, notes, and snippets.

@ForNeVeR
Last active January 4, 2016 19:19
Show Gist options
  • Save ForNeVeR/8666973 to your computer and use it in GitHub Desktop.
Save ForNeVeR/8666973 to your computer and use it in GitHub Desktop.
using System;
using System.Reflection;
interface ILoveCats
{ }
class Program
{
static void Main(string[] args)
{
var allocate = typeof(RuntimeTypeHandle).GetMethod("Allocate", BindingFlags.NonPublic | BindingFlags.Static);
var cat = allocate.Invoke(null, new[] { typeof(ILoveCats) });
Console.WriteLine(cat.GetType()); // ILoveCats
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment