Пример #1
0
		public bool MethodSigEquals(MethodBaseSig sig, MethodBase method) {
			if (sig == null || method == null)
				return false;
			if (sig.HasThis != !method.IsStatic)
				return false;
			if (sig.Generic != method.IsGenericMethod)
				return false;
			if (sig.Generic) {
				if (sig.GenParamCount != method.GetGenericArguments().Length)
					return false;
			}
			if (method.IsMethodSpec())
				method = method.Module.ResolveMethod(method.MetadataToken) ?? method;
			var mps = method.GetParameters();
			if (sig.Params.Count != mps.Length)
				return false;

			var minfo = method as MethodInfo;
			if (minfo != null) {
				if (!Equals(sig.RetType, minfo.ReturnType))
					return false;
			}
			else {
				if (sig.RetType.RemovePinnedAndModifiers().GetElementType() != ElementType.Void)
					return false;
			}

			for (int i = 0; i < mps.Length; i++) {
				if (!Equals(sig.Params[i], mps[i].ParameterType))
					return false;
			}

			return true;
		}