本文整理汇总了C#中Mono.Cecil.MethodReference.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# MethodReference.GetType方法的具体用法?C# MethodReference.GetType怎么用?C# MethodReference.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.MethodReference
的用法示例。
在下文中一共展示了MethodReference.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: convert
public MethodReference convert(MethodReference methodRef)
{
if (methodRef.GetType() != typeof(MethodReference) && methodRef.GetType() != typeof(MethodDefinition))
throw new ApplicationException("Invalid method reference type");
if (isInOurModule(methodRef))
return tryGetMethodDefinition(methodRef);
return copy(methodRef);
}
示例2: copy
public MethodReference copy(MethodReference methodRef)
{
if (methodRef.GetType() != typeof(MethodReference) && methodRef.GetType() != typeof(MethodDefinition))
throw new ApplicationException("Invalid method reference type");
var newMethodRef = new MethodReference(methodRef.Name, convert(methodRef.MethodReturnType.ReturnType), convert(methodRef.DeclaringType));
newMethodRef.HasThis = methodRef.HasThis;
newMethodRef.ExplicitThis = methodRef.ExplicitThis;
newMethodRef.CallingConvention = methodRef.CallingConvention;
foreach (var param in methodRef.Parameters)
newMethodRef.Parameters.Add(new ParameterDefinition(param.Name, param.Attributes, convert(param.ParameterType)));
foreach (var gp in methodRef.GenericParameters)
newMethodRef.GenericParameters.Add(new GenericParameter(gp.Name, newMethodRef));
return newMethodRef;
}
示例3: AssertMethodReferencesAreIdentical
private void AssertMethodReferencesAreIdentical(MethodReference expected, MethodReference actual)
{
Assert.Equal(expected.GetType(), actual.GetType());
this.AssertGenericParametersAreIdentical(expected, actual);
this.AssertTypeReferencesAreIdentical(expected.DeclaringType, actual.DeclaringType);
if (expected is GenericInstanceMethod)
{
this.AssertGenericArgumentsAreIdentical((GenericInstanceMethod)expected, (GenericInstanceMethod)actual);
}
}