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


C# MethodDefinition.RemainsInRoleInterface方法代码示例

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


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

示例1: MorphMethod

            private void MorphMethod(MethodDefinition method)
            {
                Tracer.TraceVerbose("Morph method: {0}", method.ToString());

                if (method.IsConstructor && method.HasParameters) {
                  AddMessage(Error.RoleCannotContainParameterizedConstructor(method.DeclaringType, method));
                  return;
                }

                bool remove = !method.RemainsInRoleInterface();
                if (remove) {
                  Defer(() => {
                method.DeclaringType.Methods.Remove(method);
                  });
                  return;
                }

                if (method.IsFamily || method.IsFamilyOrAssembly) {
                  // if the method is protected, mark it as guarded
                  method.MarkAsGuarded(method.DeclaringType.Module);
                }

                method.Attributes =
                  MethodAttributes.Public |
                  MethodAttributes.HideBySig | // TODO: what about HideByName?
                  MethodAttributes.NewSlot |
                  MethodAttributes.Abstract |
                  //MethodAttributes.Strict | // TODO: VB.NET uses this!
                  MethodAttributes.Virtual;
                if (method.IsPropertyAccessor() || method.IsEventAccessor()) {
                  method.Attributes |= MethodAttributes.SpecialName;
                }

                // the method body will be cleared in a wrap-up action
                Defer(() => {
                  method.Body = null;
                });
            }
开发者ID:cessationoftime,项目名称:nroles,代码行数:38,代码来源:MorphIntoInterfaceMutator.cs

示例2: RemoveAccessor

 private bool RemoveAccessor(MethodDefinition accessor)
 {
     return !accessor.RemainsInRoleInterface();
 }
开发者ID:cessationoftime,项目名称:nroles,代码行数:4,代码来源:MorphIntoInterfaceMutator.cs

示例3: AdjustCalls

 private void AdjustCalls(MethodDefinition sourceMethod, MethodDefinition staticMethod)
 {
     if (sourceMethod.IsConstructor) {
       // remove base class constructor call ( : base(...) )
       // other constructor calls ( : this(...) ) are not present because roles cannot have parameterized constructors
       RemoveBaseClassConstructorCall(staticMethod);
     }
     else {
       if (!sourceMethod.RemainsInRoleInterface()) {
     // methods that are removed from the role interface must have their callees adjusted to call directly the method in the Code class
     // constructors are an not included because calling a role constructor is an error
     AdjustMethodCalls(sourceMethod, staticMethod);
       }
     }
 }
开发者ID:cessationoftime,项目名称:nroles,代码行数:15,代码来源:ExtractCodeClassMutator.cs


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