Skip to content

Instantly share code, notes, and snippets.

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