static void Main(string[] args) { IDynamicFactory factory = DynamicAssemblyBuilder.CreateDynamic("Test"); var t = factory.CreateInterfaceProxy("test"); Type ikkType = typeof(IKk); var gg = ikkType.GetGenericArguments(); Type aspect = typeof(DefaultAspectAttribute); var c = new CustomAttributeBuilder(aspect.GetConstructors()[0], new object[0]); t.TypeFactory.TypeBuilder.SetCustomAttribute(c); t.TypeFactory.AddInterface(ikkType); var field = t.BuildField("target", typeof(IKk), FieldAttributes.Private); var type = t.BuildField("type", typeof(Type), FieldAttributes.Private); var proxyConstructor = t.ProxyConstructor(field, type); proxyConstructor.SetConstructor(null); var pm = t.ProxyMethod(field, ikkType.GetMethods()[0], type); pm.SetProxyMethod(ikkType.GetMethods()[0], ikkType); Type finish = t.Finish(); var k = new Program(8, 9); IKk dist = (IKk)Activator.CreateInstance(finish, k, typeof(IKk)); dist.TestBB(1, 20); }