コード例 #1
0
        private bool IgnoreCompilerGeneratedMember(MemberInfo member, ObjectDumperSettings settings)
        {
            if (settings.WriteCompilerGeneratedTypes)
            {
                return(false);
            }

            var result = member.GetCustomAttributes(typeof(CompilerGeneratedAttribute), true);

            return(result.Length != 0);
        }
コード例 #2
0
        internal IEnumerable <TraverseNode> GetChildren(ObjectDumperSettings settings)
        {
            List <TraverseNode> children = new List <TraverseNode>();

            if (Item == null || Item is ValueType || Item is string)
            {
                return(children);
            }

            if (Item is IEnumerable)
            {
                return(children);
            }

            List <MemberInfo> members = Item.GetType().GetMembers(settings.BindingFlags).ToList();

            foreach (MemberInfo member in members)
            {
                Type type = member.DeclaringType;
                if (type.FullName.Equals($"System.{type.Name}", StringComparison.Ordinal))
                {
                    continue;
                }

                if (type.FullName.Equals($"System.Reflection.{type.Name}", StringComparison.Ordinal))
                {
                    continue;
                }

                if (IgnoreCompilerGeneratedMember(member, settings))
                {
                    continue;
                }

                ClassMember cm = new ClassMember(member);
                if (cm.IsValid())
                {
                    object value = cm.GetValue(Item);
                    children.Add(new TraverseNode(cm.GetName(), cm.GetClassMemberType().FullName, value, this, Level + 1));
                }
            }

            return(children.OrderBy(x => x.Name));
        }
コード例 #3
0
 public RecursiveObjectDumper()
 {
     _formatter = new InternalObjectFormatter();
     Settings   = new ObjectDumperSettings();
 }
コード例 #4
0
 public TraversalObjectDumper()
 {
     _formatter = new InternalObjectFormatter();
     Settings   = new ObjectDumperSettings();
 }