Beispiel #1
0
        public TypeReflectionInfo(Object obj, Type type)
        {
            this.typeName = obj.GetType().ToString();
            this.methods  = new List <MethodInfo>();

            this.properties          = new PropertyDetails();
            this.properties.children = new List <PropertyDetails>();
            this.properties.name     = obj.ToString();
            this.properties.readOnly = type.IsValueType;
            this.properties.type     = type;
            this.properties.value    = obj;

            QSUtils.DepthFirstPropertyDetails(this.properties);
        }
Beispiel #2
0
        static public List <string> ConvertTypeReflectionInfoToString(PropertyDetails parentDetails, int indentLevel = 0)
        {
            List <string> output = new List <string>();

            for (int j = 0; j < parentDetails.children.Count; ++j)
            {
                PropertyDetails details = parentDetails.children[j];

                String item = string.Format("{0} => {1}", details.name, details.value);
                item = item.PadLeft(indentLevel);
                output.Add(item);

                indentLevel += 2;
                List <string> childOutput = QSUtils.ConvertTypeReflectionInfoToString(details, indentLevel);
                output.AddRange(childOutput);
                indentLevel -= 2;
            }

            return(output);
        }