当前位置: 首页>>代码示例>>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;未经允许,请勿转载。