本文整理匯總了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;
}
});
}
}