示例#1
0
        public static string GetFullStateInfo([CanBeNull] object target, BindingFlags bindingFlags, [CanBeNull] string[] blacklist)
        {
            if (target == null)
            {
                return("null");
            }

            if (blacklist == null)
            {
                blacklist = ArrayPool <string> .ZeroSizeArray;
            }

            var sb = StringBuilderPool.Create();

            sb.Append(target + " Full State:\r\n");

            if (bindingFlags.HasFlag(BindingFlags.DeclaredOnly))
            {
                GetFullStateInfoDeclaredOnly(target, target.GetType(), sb, bindingFlags, blacklist);
            }
            else
            {
                bindingFlags = (BindingFlags)bindingFlags.SetFlag(BindingFlags.DeclaredOnly);

                for (var type = target.GetType(); type != null; type = type.BaseType)
                {
                    GetFullStateInfoDeclaredOnly(target, type, sb, bindingFlags, blacklist);
                }
            }

            return(StringBuilderPool.ToStringAndDispose(ref sb));
        }