Пример #1
0
 /// <summary>
 /// describes about the type
 /// </summary>
 /// <param name="specimen">Object to examine</param>
 /// <param name="what_part">what the caller wants to describe</param>
 /// <returns></returns>
 public override string describe(object specimen, fm.Itypeinfo.WHAT what_part)
 {
     lock (this)
     {
         reflector reflector_ = new reflector(specimen);
         return(reflector_.describe(what_part));
     }
 }
Пример #2
0
        /// <summary>
        /// The only methods on the public interface used for getting the description.
        /// </summary>
        /// <param name="what_part">or-ed enum values teling us what caller wants described</param>
        /// <returns>report in a string</returns>
        public string describe(fm.Itypeinfo.WHAT what_part)
        {
            lock (this)
            {
                fm.flags what      = new flags(what_part);
                bool     SHOW_ATTR = what.contains(Itypeinfo.WHAT.ATTRIBUTES);

                Type type = this.specimen_.GetType();
                System.Text.StringBuilder retval = new System.Text.StringBuilder();
                // this info we return always
                retval.AppendFormat("{0}{1}", Environment.NewLine, STRNGS.NME);
                retval.AppendFormat("{0}\t{1}", Environment.NewLine, base_data(type, true));


                if (what == Itypeinfo.WHAT.INTERFACES)
                {
                    bool show_m = what.contains(Itypeinfo.WHAT.INTERFACE_METHODS);
                    retval.Append(interfaces(this.specimen_, SHOW_ATTR, show_m));
                }

                if (what == Itypeinfo.WHAT.PARENT)
                {
                    if (type.BaseType != null)
                    {
                        retval.Append(STRNGS.BTP);
                        retval.AppendFormat("{0}\t{1}", Environment.NewLine, base_data(type.BaseType, SHOW_ATTR));
                    }
                }

                if (what == Itypeinfo.WHAT.FIELDS)
                {
                    retval.Append(fields(this.specimen_));
                }

                if (what == Itypeinfo.WHAT.PROPERTIES)
                {
                    retval.Append(propertys(this.specimen_));
                }

                if (what == Itypeinfo.WHAT.METHODS)
                {
                    retval.Append(methods(this.specimen_.GetType(), SHOW_ATTR));
                }

                return(retval.ToString());
            }
        }