當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。