本文整理匯總了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;
});
}
示例2: RemoveAccessor
private bool RemoveAccessor(MethodDefinition accessor)
{
return !accessor.RemainsInRoleInterface();
}
示例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);
}
}
}