当前位置: 首页>>代码示例>>C#>>正文


C# TypeBuilder.DefineMethodOverride方法代码示例

本文整理汇总了C#中IKVM.Reflection.Emit.TypeBuilder.DefineMethodOverride方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBuilder.DefineMethodOverride方法的具体用法?C# TypeBuilder.DefineMethodOverride怎么用?C# TypeBuilder.DefineMethodOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IKVM.Reflection.Emit.TypeBuilder的用法示例。


在下文中一共展示了TypeBuilder.DefineMethodOverride方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EmitMapXmlMetadata


//.........这里部分代码省略.........
                             }
                         }
                     }
                 }
             }
             if(clazz.Methods != null)
             {
                 // HACK this isn't the right place to do this, but for now it suffices
                 foreach(IKVM.Internal.MapXml.Method method in clazz.Methods)
                 {
                     // are we adding a new method?
                     if(GetMethodWrapper(method.Name, method.Sig, false) == null)
                     {
                         if(method.body == null)
                         {
                             Console.Error.WriteLine("Error: Method {0}.{1}{2} in xml remap file doesn't have a body.", clazz.Name, method.Name, method.Sig);
                             continue;
                         }
                         bool setmodifiers = false;
                         MethodAttributes attribs = method.MethodAttributes;
                         MapModifiers(method.Modifiers, false, out setmodifiers, ref attribs);
                         Type returnType;
                         Type[] parameterTypes;
                         MapSignature(method.Sig, out returnType, out parameterTypes);
                         MethodBuilder mb = typeBuilder.DefineMethod(method.Name, attribs, returnType, parameterTypes);
                         if(setmodifiers)
                         {
                             AttributeHelper.SetModifiers(mb, (Modifiers)method.Modifiers, false);
                         }
                         if([email protected] != null)
                         {
                             MethodWrapper mw = GetClassLoader().LoadClassByDottedName([email protected]).GetMethodWrapper([email protected], method.Sig, true);
                             mw.Link();
                             typeBuilder.DefineMethodOverride(mb, (MethodInfo)mw.GetMethod());
                         }
                         CompilerClassLoader.AddDeclaredExceptions(mb, method.throws);
                         CodeEmitter ilgen = CodeEmitter.Create(mb);
                         method.Emit(classLoader, ilgen);
                         ilgen.DoEmit();
                         if(method.Attributes != null)
                         {
                             foreach(IKVM.Internal.MapXml.Attribute attr in method.Attributes)
                             {
                                 AttributeHelper.SetCustomAttribute(classLoader, mb, attr);
                             }
                         }
                     }
                 }
                 foreach(IKVM.Internal.MapXml.Method method in clazz.Methods)
                 {
                     if(method.Attributes != null)
                     {
                         foreach(MethodWrapper mw in methods)
                         {
                             if(mw.Name == method.Name && mw.Signature == method.Sig)
                             {
                                 MethodBuilder mb = mw.GetMethod() as MethodBuilder;
                                 if(mb != null)
                                 {
                                     foreach(IKVM.Internal.MapXml.Attribute attr in method.Attributes)
                                     {
                                         AttributeHelper.SetCustomAttribute(classLoader, mb, attr);
                                     }
                                 }
                             }
                         }
开发者ID:T0pp3r,项目名称:ikvm-fork,代码行数:67,代码来源:AotTypeWrapper.cs


注:本文中的IKVM.Reflection.Emit.TypeBuilder.DefineMethodOverride方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。