C# existential type

Run Settings
LanguageC#
Language Version
Run Command
using System; class MagicBox{ private Object member; private Type type; public static MagicBox createMagicBox<T>(T obj){ MagicBox box=new MagicBox(); box.member=obj; box.type=typeof(T); return box; } public T unwrap<T>(){ return (T)member; } public bool is_a<T>(){ Type t=typeof(T); return type==t; } } class MainClass { static void Main() { Console.WriteLine("Hello World!"); MagicBox box=MagicBox.createMagicBox(20); if(box.is_a<int>()){ Console.WriteLine("Yes. "+box.unwrap<int>()); }else{ Console.WriteLine("Nope."); } if(box.is_a<float>()){ Console.WriteLine("Yes."); }else{ Console.WriteLine("Nope."); } } }
Editor Settings
Theme
Key bindings
Full width
Lines