本文整理汇总了C#中System.Compiler.Method.FindShadow方法的典型用法代码示例。如果您正苦于以下问题:C# Method.FindShadow方法的具体用法?C# Method.FindShadow怎么用?C# Method.FindShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Compiler.Method
的用法示例。
在下文中一共展示了Method.FindShadow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMethod
/// <summary>
/// Visiting a method in the shadow assembly
/// </summary>
public override void VisitMethod(Method method)
{
if (method == null) return;
// we might have copied this method already
if (this.duplicatedMembers[method.UniqueKey] != null)
{
return;
}
Method targetMethod = method.FindShadow(this.targetAssembly);
if (targetMethod != null)
{
Contract.Assume(targetMethod.ParameterCount == method.ParameterCount);
for (int i = 0, n = method.ParameterCount; i < n; i++)
{
Contract.Assert(targetMethod.ParameterCount > 0);
var parameter = method.Parameters[i];
if (parameter == null) continue;
this.outOfBandDuplicator.DuplicateFor[parameter.UniqueKey] = targetMethod.Parameters[i];
}
CopyAttributesWithoutDuplicateUnlessAllowMultiple(targetMethod, method);
CopyReturnAttributesWithoutDuplicateUnlessAllowMultiple(targetMethod, method);
targetMethod.SetDelayedContract((m, dummy) =>
{
var savedMethod = this.outOfBandDuplicator.TargetMethod;
this.outOfBandDuplicator.TargetMethod = method;
this.outOfBandDuplicator.TargetType = method.DeclaringType;
Contract.Assume(method.DeclaringType != null);
this.outOfBandDuplicator.TargetModule = method.DeclaringType.DeclaringModule;
MethodContract mc = this.outOfBandDuplicator.VisitMethodContract(method.Contract);
targetMethod.Contract = mc;
if (savedMethod != null)
{
this.outOfBandDuplicator.TargetMethod = savedMethod;
this.outOfBandDuplicator.TargetType = savedMethod.DeclaringType;
}
});
}
}