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


C# MethodReference.CompareSignature方法代碼示例

本文整理匯總了C#中Mono.Cecil.MethodReference.CompareSignature方法的典型用法代碼示例。如果您正苦於以下問題:C# MethodReference.CompareSignature方法的具體用法?C# MethodReference.CompareSignature怎麽用?C# MethodReference.CompareSignature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Cecil.MethodReference的用法示例。


在下文中一共展示了MethodReference.CompareSignature方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IsBase

		static bool IsBase (MethodReference method, MethodReference mr)
		{
			if (mr.Name != method.Name)
				return false;

			if (!mr.CompareSignature (method))
				return false;

			foreach (TypeDefinition baseType in method.DeclaringType.AllSuperTypes ()) {
				if (mr.DeclaringType.FullName == baseType.FullName)
					return true;
			}
			return false;
		}
開發者ID:avandecreme,項目名稱:mono-tools,代碼行數:14,代碼來源:AvoidUnnecessaryOverridesRule.cs

示例2: IsBase

		static bool IsBase (MethodReference method, MethodReference mr)
		{
			if (mr.Name != method.Name)
				return false;

			if (!mr.CompareSignature (method))
				return false;

			TypeReference type = mr.DeclaringType;
			foreach (TypeDefinition baseType in method.DeclaringType.AllSuperTypes ()) {
				if (baseType.IsNamed (type.Namespace, type.Name))
					return true;
			}
			return false;
		}
開發者ID:FreeBSD-DotNet,項目名稱:mono-tools,代碼行數:15,代碼來源:AvoidUnnecessaryOverridesRule.cs

示例3: SignatureMatches

        private static bool SignatureMatches(MethodReference method, MethodReference baseMethod, bool explicitInterfaceCheck)
        {
            string name = method.Name;
            string base_name = baseMethod.Name;

            if (name != base_name) {
                if (!explicitInterfaceCheck)
                    return false;

                TypeReference btype = baseMethod.DeclaringType;
                string bnspace = btype.Namespace;
                if (!name.StartsWith (bnspace, StringComparison.Ordinal))
                    return false;
                if (name [bnspace.Length] != '.')
                    return false;

                string bname = btype.Name;
                if (String.CompareOrdinal (bname, 0, name, bnspace.Length + 1, bname.Length) != 0)
                    return false;

                int dot = bnspace.Length + bname.Length + 1;
                if (name [dot] != '.')
                    return false;

                if (name.LastIndexOf (base_name, StringComparison.Ordinal) != dot + 1)
                    return false;
            }
            return method.CompareSignature (baseMethod);
        }
開發者ID:alfredodev,項目名稱:mono-tools,代碼行數:29,代碼來源:ParameterNamesShouldMatchOverridenMethodRule.cs

示例4: CompareMethods

		private static bool CompareMethods (MethodReference method1, MethodReference method2, bool virtual_call)
		{
			if (method1 == null)
				return (method2 == null);
			if (method2 == null)
				return false;

			// shortcut, if it's not virtual then only compare metadata tokens
			if (!virtual_call)
				return (method1.MetadataToken == method2.MetadataToken);

			// we could be implementing an interface (skip position 0 because of .ctor and .cctor)
			string m1name = method1.Name;
			bool explicit_interface = (m1name.IndexOf ('.') > 0);
			if (!explicit_interface && (m1name != method2.Name))
				return false;

			// compare parameters
			if (!method1.CompareSignature (method2))
				return false;

			TypeReference t2 = method2.DeclaringType;
			TypeDefinition t2r = t2.Resolve ();
			if (!explicit_interface && (t2r != null) && !t2r.IsInterface)
				return true;

			string t2name = t2.FullName;
			// we're calling into an interface and this could be us!
			foreach (MethodReference mr in method1.Resolve ().Overrides) {
				if (t2name == mr.DeclaringType.FullName)
					return true;
			}
			return false;
		}
開發者ID:boothead,項目名稱:mono-tools,代碼行數:34,代碼來源:BadRecursiveInvocationRule.cs


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