GetMethod() public static method

public static GetMethod ( System type, System method ) : System.Reflection.MethodInfo
type System
method System
return System.Reflection.MethodInfo
 public override MethodInfo GetRemoveMethod(bool nonPublic)
 {
     if (this.evt.remove_method == null || (!nonPublic && !this.evt.remove_method.IsPublic))
     {
         return(null);
     }
     return(TypeBuilder.GetMethod(this.instantiation, this.evt.remove_method));
 }
Esempio n. 2
0
 // Implementation of "GetMethod".
 protected override MethodInfo GetMethodImpl
     (String name, BindingFlags bindingAttr,
     Binder binder, CallingConventions callConvention,
     Type[] types, ParameterModifier[] modifiers)
 {
     return(builder.GetMethod(name, bindingAttr, binder,
                              callConvention, types, modifiers));
 }
Esempio n. 3
0
 public override MethodInfo GetRaiseMethod(bool nonPublic)
 {
     if (evt.raise_method == null || (!nonPublic && !evt.raise_method.IsPublic))
     {
         return(null);
     }
     return(TypeBuilder.GetMethod(instantiation, evt.raise_method));
 }
Esempio n. 4
0
        public override MethodInfo GetSetMethod(bool nonPublic)
        {
            MethodInfo mi = prop.GetSetMethod(nonPublic);

            if (mi != null && prop.DeclaringType == instantiation.generic_type)
            {
                mi = TypeBuilder.GetMethod(instantiation, mi);
            }
            return(mi);
        }
Esempio n. 5
0
        public override MethodInfo GetRemoveMethod(bool nonPublic)
        {
            MethodInfo remove = event_builder != null ? event_builder.remove_method : event_info.GetRemoveMethod(nonPublic);

            if (remove == null || (!nonPublic && !remove.IsPublic))
            {
                return(null);
            }
            return(TypeBuilder.GetMethod(instantiation, remove));
        }
Esempio n. 6
0
        public override MethodInfo GetAddMethod(bool nonPublic)
        {
            MethodInfo add = event_builder != null ? event_builder.add_method : event_info.GetAddMethod(nonPublic);

            if (add == null || (!nonPublic && !add.IsPublic))
            {
                return(null);
            }
            return(TypeBuilder.GetMethod(instantiation, add));
        }
        public override MethodInfo?GetRaiseMethod(bool nonPublic)
        {
            MethodInfo?raise = event_builder != null ? event_builder.raise_method : event_info !.GetRaiseMethod(nonPublic);

            if (raise == null || (!nonPublic && !raise.IsPublic))
            {
                return(null);
            }
            return(TypeBuilder.GetMethod(instantiation, raise));
        }
        public override MethodInfo GetSetMethod(bool nonPublic)
        {
            MethodInfo methodInfo = this.prop.GetSetMethod(nonPublic);

            if (methodInfo != null && this.prop.DeclaringType == this.instantiation.generic_type)
            {
                methodInfo = TypeBuilder.GetMethod(this.instantiation, methodInfo);
            }
            return(methodInfo);
        }
Esempio n. 9
0
        public override ParameterInfo[] GetParameters()
        {
            if (!m_bIsBaked || m_containingType == null || m_containingType.BakedRuntimeType == null)
            {
                throw new NotSupportedException(SR.InvalidOperation_TypeNotCreated);
            }

            MethodInfo rmi = m_containingType.GetMethod(m_strName, m_parameterTypes);

            return(rmi.GetParameters());
        }
        public override MethodInfo[] GetOtherMethods(bool nonPublic)
        {
            if (this.evt.other_methods == null)
            {
                return(new MethodInfo[0]);
            }
            ArrayList arrayList = new ArrayList();

            foreach (MethodBuilder methodInfo in this.evt.other_methods)
            {
                if (nonPublic || methodInfo.IsPublic)
                {
                    arrayList.Add(TypeBuilder.GetMethod(this.instantiation, methodInfo));
                }
            }
            MethodInfo[] array = new MethodInfo[arrayList.Count];
            arrayList.CopyTo(array, 0);
            return(array);
        }
        public override MethodInfo[] GetOtherMethods(bool nonPublic)
        {
            MethodInfo[]? other = event_builder != null ? event_builder.other_methods : event_info !.GetOtherMethods(nonPublic);
            if (other == null)
            {
                return(Array.Empty <MethodInfo>());
            }

            List <MethodInfo> res = new List <MethodInfo>();

            foreach (MethodInfo method in other)
            {
                if (nonPublic || method.IsPublic)
                {
                    res.Add(TypeBuilder.GetMethod(instantiation, method));
                }
            }
            return(res.ToArray());
        }
Esempio n. 12
0
        public override MethodInfo[] GetOtherMethods(bool nonPublic)
        {
            if (evt.other_methods == null)
            {
                return(new MethodInfo [0]);
            }

            ArrayList ar = new ArrayList();

            foreach (MethodInfo method in evt.other_methods)
            {
                if (nonPublic || method.IsPublic)
                {
                    ar.Add(TypeBuilder.GetMethod(instantiation, method));
                }
            }
            MethodInfo[] res = new MethodInfo [ar.Count];
            ar.CopyTo(res, 0);
            return(res);
        }
Esempio n. 13
0
        public override MethodInfo[] GetOtherMethods(bool nonPublic)
        {
            MethodInfo[] other = event_builder != null ? event_builder.other_methods : event_info.GetOtherMethods(nonPublic);
            if (other == null)
            {
                return(new MethodInfo [0]);
            }

            ArrayList ar = new ArrayList();

            foreach (MethodInfo method in other)
            {
                if (nonPublic || method.IsPublic)
                {
                    ar.Add(TypeBuilder.GetMethod(instantiation, method));
                }
            }
            MethodInfo[] res = new MethodInfo [ar.Count];
            ar.CopyTo(res, 0);
            return(res);
        }
Esempio n. 14
0
        private MethodInfo GetMethodInfo(string p, TypeBuilder Class, Type type, Type[] parameters = null)
        {
            if(Class != null)
            {
                return Class.GetMethod(p);
            }
            else if (type != null)
            {
                return type.GetMethod(p);
            }
            else
            {
                mainType.CreateType();
                MethodInfo minfo = mainType.GetMethod(p);
                if (minfo != null)
                {
                    return minfo;
                }
                else
                {
                    if (p.Contains('.'))
                    {
                        string[] names = p.Split('.');
                        Type t = FindType(string.Join(".", names.Take(names.Length - 1)));

                        if (t != null)
                        {
                            return t.GetMethod(names[names.Length - 1], parameters);
                        }
                    }
                    throw new Exception("Cannot find method");
                }
            }
        }