Utils.MInfo C# (CSharp) Méthode

MInfo() public static méthode

public static MInfo ( object ctype, string mname ) : void
ctype object
mname string
Résultat void
    public static void MInfo(object ctype, string mname) {
        Type t;
        if (ctype == null) {
            if (lastClass != null)
                ctype = lastClass;
            else
                return;
        }
        if (ctype is String) {
            string cname = (string)ctype;
            if (cname.Length < 7 || cname.Substring(0,7) != "System.")
                cname = "System." + cname;
            t = Type.GetType(cname);
             if (t == null)  throw(new Exception("is not a type"));
        } else
            t = (Type)ctype;
        lastClass = t;
        try {
            string lastName = "";
            int k = 0;
            if (! t.IsClass && ! t.IsInterface)
                throw(new Exception("is not a class, struct or interface"));            
            foreach (MethodInfo mi in t.GetMethods()) {
                if (mi.IsPublic && mi.DeclaringType == t) 
                    if (mname == null) {
                        if (mi.Name != lastName && mi.Name.IndexOf('_') == -1) {
                            lastName = mi.Name;
                            Write(lastName);
                            if (++k == 5) {
                                Print();
                                k = 0;
                            } else
                                Write(" ");
                        }
                    } else {
                        if (mi.Name == mname) {
                            string proto = mi.ToString();
                            proto = proto.Replace("System.","");
                            if (mi.IsStatic)
                                proto = "static " + proto;
                            if (mi.IsVirtual)
                                proto = "virtual " + proto;
                            Print(proto);                            
                        }                            
                    }
            }
            if (k > 0)
                Print();
        } catch(Exception e) {
            Print("Error: " + ctype,e.Message);
        }
    }