public static T GetInstanceTyped <T>(IntPtr ptr) where T : class { T o = Objects.GetInstance(ptr, typeof(T)) as T; return(o); }