public override bool Equals(object obj) { if (!this.IsGenericMethod) { return(obj == this); } RuntimeMethodInfo runtimeMethodInfo = obj as RuntimeMethodInfo; if (runtimeMethodInfo == null || !runtimeMethodInfo.IsGenericMethod) { return(false); } IRuntimeMethodInfo runtimeMethodInfo2 = RuntimeMethodHandle.StripMethodInstantiation(this); IRuntimeMethodInfo runtimeMethodInfo3 = RuntimeMethodHandle.StripMethodInstantiation(runtimeMethodInfo); if (runtimeMethodInfo2.Value.Value != runtimeMethodInfo3.Value.Value) { return(false); } Type[] genericArguments = this.GetGenericArguments(); Type[] genericArguments2 = runtimeMethodInfo.GetGenericArguments(); if (genericArguments.Length != genericArguments2.Length) { return(false); } for (int i = 0; i < genericArguments.Length; i++) { if (genericArguments[i] != genericArguments2[i]) { return(false); } } return(!(this.DeclaringType != runtimeMethodInfo.DeclaringType) && !(this.ReflectedType != runtimeMethodInfo.ReflectedType)); }
public override MethodInfo GetGenericMethodDefinition() { if (!this.IsGenericMethod) { throw new InvalidOperationException(); } return(RuntimeType.GetMethodBase(this.m_declaringType, RuntimeMethodHandle.StripMethodInstantiation(this)) as MethodInfo); }
public override MethodInfo GetGenericMethodDefinition() { if (!IsGenericMethod) throw new InvalidOperationException(); Contract.EndContractBlock(); return RuntimeType.GetMethodBase(m_declaringType, RuntimeMethodHandle.StripMethodInstantiation(this)) as MethodInfo; }
[System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(object obj) { if (!IsGenericMethod) { return(obj == (object)this); } // We cannot do simple object identity comparisons for generic methods. // Equals will be called in CerHashTable when RuntimeType+RuntimeTypeCache.GetGenericMethodInfo() // retrive items from and insert items into s_methodInstantiations which is a CerHashtable. // RuntimeMethodInfo mi = obj as RuntimeMethodInfo; if (mi == null || !mi.IsGenericMethod) { return(false); } // now we know that both operands are generic methods IRuntimeMethodInfo handle1 = RuntimeMethodHandle.StripMethodInstantiation(this); IRuntimeMethodInfo handle2 = RuntimeMethodHandle.StripMethodInstantiation(mi); if (handle1.Value.Value != handle2.Value.Value) { return(false); } Type[] lhs = GetGenericArguments(); Type[] rhs = mi.GetGenericArguments(); if (lhs.Length != rhs.Length) { return(false); } for (int i = 0; i < lhs.Length; i++) { if (lhs[i] != rhs[i]) { return(false); } } if (DeclaringType != mi.DeclaringType) { return(false); } if (ReflectedType != mi.ReflectedType) { return(false); } return(true); }
public override bool Equals(object obj) { if (!this.IsGenericMethod) { return(obj == this); } RuntimeMethodInfo method = obj as RuntimeMethodInfo; if ((method == null) || !method.IsGenericMethod) { return(false); } IRuntimeMethodInfo info2 = RuntimeMethodHandle.StripMethodInstantiation(this); IRuntimeMethodInfo info3 = RuntimeMethodHandle.StripMethodInstantiation(method); if (info2.Value.Value != info3.Value.Value) { return(false); } Type[] genericArguments = this.GetGenericArguments(); Type[] typeArray2 = method.GetGenericArguments(); if (genericArguments.Length != typeArray2.Length) { return(false); } for (int i = 0; i < genericArguments.Length; i++) { if (genericArguments[i] != typeArray2[i]) { return(false); } } if (this.DeclaringType != method.DeclaringType) { return(false); } if (this.ReflectedType != method.ReflectedType) { return(false); } return(true); }
public override bool Equals(object obj) { if (!this.IsGenericMethod) { return(obj == this); } RuntimeMethodInfo runtimeMethodInfo = obj as RuntimeMethodInfo; if ((MethodInfo)runtimeMethodInfo == (MethodInfo)null || !runtimeMethodInfo.IsGenericMethod || RuntimeMethodHandle.StripMethodInstantiation((IRuntimeMethodInfo)this).Value.Value != RuntimeMethodHandle.StripMethodInstantiation((IRuntimeMethodInfo)runtimeMethodInfo).Value.Value) { return(false); } Type[] genericArguments1 = this.GetGenericArguments(); Type[] genericArguments2 = runtimeMethodInfo.GetGenericArguments(); if (genericArguments1.Length != genericArguments2.Length) { return(false); } for (int index = 0; index < genericArguments1.Length; ++index) { if (genericArguments1[index] != genericArguments2[index]) { return(false); } } return(!(this.DeclaringType != runtimeMethodInfo.DeclaringType) && !(this.ReflectedType != runtimeMethodInfo.ReflectedType)); }