예제 #1
0
        public static ParameterInfo Resolve(this ParameterRef parameterRef)
        {
            if (parameterRef.IsEmpty)
            {
                return(null);
            }

#if RuntimeHandles
            Module     manifest = parameterRef.Resolver.GetManifest(parameterRef.AssemblyName);
            MethodBase method   = manifest.ResolveMethod(parameterRef.Constructor.IsEmpty ? parameterRef.Method.MetadataToken : parameterRef.Constructor.MetadataToken);
#else
            MethodBase method = (MethodBase)Resolve(parameterRef.Constructor) ?? Resolve(parameterRef.Method);
#endif
            return(method.GetParameters()[parameterRef.ParameterIndex]);
        }
예제 #2
0
        public static ParameterInfo Resolve(this ParameterRef parameterRef)
        {
            if (parameterRef == null)
            {
                return(null);
            }

            MethodBase method;

            if (TryUseFastReflection(parameterRef.DeclaringType, out Module manifest))
            {
                method = manifest.ResolveMethod(parameterRef.Method.MetadataToken);
            }
            else
            {
                method = parameterRef.Method.MethodBase;
            }

            return(method.GetParameters()[parameterRef.ParameterIndex]);
        }
예제 #3
0
        public static ParameterInfo Resolve(this ParameterRef parameterRef)
        {
            if (parameterRef.IsEmpty)
            {
                return(null);
            }

            MethodBase method;

#if RuntimeHandles
            if (TryUseFastReflection(parameterRef.DeclaringType, out Module manifest))
            {
                method = manifest.ResolveMethod(parameterRef.Constructor.IsEmpty ? parameterRef.Method.MetadataToken : parameterRef.Constructor.MetadataToken);
            }
            else
#endif
            {
                method = parameterRef.Constructor.ConstructorInfo ?? parameterRef.Method.MethodBase;
            }

            return(method.GetParameters()[parameterRef.ParameterIndex]);
        }