當前位置: 首頁>>代碼示例>>C#>>正文


C# MethodReference.GetType方法代碼示例

本文整理匯總了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);
        }
開發者ID:huliang,項目名稱:de4dot,代碼行數:9,代碼來源:MemberReferenceConverter.cs

示例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;
        }
開發者ID:huliang,項目名稱:de4dot,代碼行數:15,代碼來源:MemberReferenceConverter.cs

示例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);
     }
 }
開發者ID:hach-que,項目名稱:Dx,代碼行數:10,代碼來源:ProcessorUtilities.cs


注:本文中的Mono.Cecil.MethodReference.GetType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。