GetMethods() 개인적인 메소드

private GetMethods ( ) : System.Reflection.MethodBase[]
리턴 System.Reflection.MethodBase[]
예제 #1
0
        internal bool NeedsDefaultArgs(IntPtr args)
        {
            int pynargs = Runtime.Interop.PyTuple_Size(args);

            MethodBase[] methods = SetterBinder.GetMethods();
            if (methods.Length == 0)
            {
                return(false);
            }

            MethodBase mi = methods[0];

            ParameterInfo[] pi = mi.GetParameters();
            // need to subtract one for the value
            int clrnargs = pi.Length - 1;

            if (pynargs == clrnargs || pynargs > clrnargs)
            {
                return(false);
            }

            for (int v = pynargs; v < clrnargs; v++)
            {
                if (pi[v].DefaultValue == DBNull.Value)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        internal bool NeedsDefaultArgs(BorrowedReference args)
        {
            var pynargs = Runtime.PyTuple_Size(args);
            var methods = SetterBinder.GetMethods();

            if (methods.Count == 0)
            {
                return(false);
            }

            MethodBase mi = methods[0].MethodBase;

            ParameterInfo[] pi = mi.GetParameters();
            // need to subtract one for the value
            int clrnargs = pi.Length - 1;

            if (pynargs == clrnargs || pynargs > clrnargs)
            {
                return(false);
            }

            for (var v = pynargs; v < clrnargs; v++)
            {
                if (pi[v].DefaultValue == DBNull.Value)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #3
0
        /// <summary>
        /// Helper to get docstrings from reflected method / param info.
        /// </summary>
        internal IntPtr GetDocString()
        {
            if (doc != IntPtr.Zero)
            {
                return(doc);
            }
            var  str    = "";
            Type marker = typeof(DocStringAttribute);

            MethodBase[] methods = binder.GetMethods();
            foreach (MethodBase method in methods)
            {
                if (str.Length > 0)
                {
                    str += Environment.NewLine;
                }
                var attrs = (Attribute[])method.GetCustomAttributes(marker, false);
                if (attrs.Length == 0)
                {
                    str += method.ToString();
                }
                else
                {
                    var attr = (DocStringAttribute)attrs[0];
                    str += attr.DocString;
                }
            }
            doc = Runtime.PyString_FromString(str);
            return(doc);
        }
예제 #4
0
        internal bool NeedsDefaultArgs(IntPtr args)
        {
            var methods = SetterBinder.GetMethods();

            if (methods.Count == 0)
            {
                return(false);
            }
            int pynargs = Runtime.PyTuple_Size(args);

            var pi = methods[0].ParameterInfo;
            // need to subtract one for the value
            int clrnargs = pi.Length - 1;

            if (pynargs == clrnargs || pynargs > clrnargs)
            {
                return(false);
            }

            for (int v = pynargs; v < clrnargs; v++)
            {
                if (pi[v].DefaultValue == DBNull.Value)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #5
0
        //====================================================================
        // Helper to get docstrings from reflected method / param info.
        //====================================================================

        internal IntPtr GetDocString()
        {
            if (doc != IntPtr.Zero)
            {
                return(doc);
            }
            MethodBase[] methods = binder.GetMethods();
            string       str     = "";

            for (int i = 0; i < methods.Length; i++)
            {
                if (str.Length > 0)
                {
                    str += Environment.NewLine;
                }
                str += methods[i].ToString();
            }
            doc = Runtime.PyString_FromString(str);
            return(doc);
        }