// For working with a class that you are not instantiating // from managed code and where access to fields is not necessary public Iface GetClass <Iface> (string className) where Iface : ICppClass { var typeInfo = Abi.MakeTypeInfo(this, className, typeof(Iface), null, null); return((Iface)Abi.ImplementClass(typeInfo)); }
// For instantiating or working with a class that may have fields // but where overriding virtual methods in managed code is not necessary public Iface GetClass <Iface, NativeLayout> (string className) where Iface : ICppClassInstantiatable where NativeLayout : struct { var typeInfo = Abi.MakeTypeInfo(this, className, typeof(Iface), typeof(NativeLayout), null); return((Iface)Abi.ImplementClass(typeInfo)); }
/* The most powerful override. Allows the following from managed code: * + Instantiation * + Field access * + Virtual method overriding */ public Iface GetClass <Iface, NativeLayout, Managed> (string className) where Iface : ICppClassOverridable <Managed> where NativeLayout : struct where Managed : ICppObject { var typeInfo = Abi.MakeTypeInfo(this, className, typeof(Iface), typeof(NativeLayout), typeof(Managed)); return((Iface)Abi.ImplementClass(typeInfo)); }