Ejemplo n.º 1
0
        public sealed override bool Equals(Object obj)
        {
            RuntimeConstructedGenericMethodInfo other = obj as RuntimeConstructedGenericMethodInfo;

            if (other == null)
            {
                return(false);
            }
            if (!this._genericMethodDefinition.Equals(other._genericMethodDefinition))
            {
                return(false);
            }
            if (this._genericTypeArguments.Length != other._genericTypeArguments.Length)
            {
                return(false);
            }
            for (int i = 0; i < _genericTypeArguments.Length; i++)
            {
                if (!this._genericTypeArguments[i].Equals(other._genericTypeArguments[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public sealed override MethodInfo MakeGenericMethod(params Type[] typeArguments)
        {
#if ENABLE_REFLECTION_TRACE
            if (ReflectionTrace.Enabled)
                ReflectionTrace.MethodInfo_MakeGenericMethod(this, typeArguments);
#endif

            if (typeArguments == null)
                throw new ArgumentNullException("typeArguments");
            if (GenericTypeParameters.Length == 0)
                throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericMethodDefinition, this));
            RuntimeType[] genericTypeArguments = new RuntimeType[typeArguments.Length];
            for (int i = 0; i < typeArguments.Length; i++)
            {
                if (typeArguments[i] == null)
                    throw new ArgumentNullException();

                genericTypeArguments[i] = typeArguments[i] as RuntimeType;
                if (genericTypeArguments[i] == null)
                    throw new ArgumentException(SR.Format(SR.Reflection_CustomReflectionObjectsNotSupported, typeArguments[i]), "typeArguments[" + i + "]"); // Not a runtime type.
            }
            if (typeArguments.Length != GenericTypeParameters.Length)
                throw new ArgumentException(SR.Format(SR.Argument_NotEnoughGenArguments, typeArguments.Length, GenericTypeParameters.Length));
            RuntimeMethodInfo methodInfo = (RuntimeMethodInfo)RuntimeConstructedGenericMethodInfo.GetRuntimeConstructedGenericMethodInfo(this, genericTypeArguments);
            MethodInvoker methodInvoker = methodInfo.MethodInvoker; // For compatibility with other Make* apis, trigger any MissingMetadataExceptions now rather than later.
            return methodInfo;
        }
Ejemplo n.º 3
0
 public sealed override bool Equals(Object obj)
 {
     RuntimeConstructedGenericMethodInfo other = obj as RuntimeConstructedGenericMethodInfo;
     if (other == null)
         return false;
     if (!_genericMethodDefinition.Equals(other._genericMethodDefinition))
         return false;
     if (_genericTypeArguments.Length != other._genericTypeArguments.Length)
         return false;
     for (int i = 0; i < _genericTypeArguments.Length; i++)
     {
         if (!_genericTypeArguments[i].Equals(other._genericTypeArguments[i]))
             return false;
     }
     return true;
 }