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