public static object CreateInstance(Type type, params object[] args) { // Cheat var handle = type.TypeHandle; var typeStruct = (MetadataTypeStruct *)((uint **)&handle)[0]; if (typeStruct->DefaultConstructor == null) { throw new ArgumentException("Type has no parameterless constructor."); } var thisObject = Internal.AllocateObject(type.TypeHandle, typeStruct->Size); return(Intrinsic.CreateInstanceSimple(typeStruct->DefaultConstructor->Method, thisObject)); }