static void WriteCore(ParsedLayout layout, object value, string property, TextWriter tw)
 {
     if (value == null)
     {
         layout.WriteVar(tw, property, "<null>", false);
     }
     else
     {
         bool escape = IsEscapedType(value.GetType());
         layout.WriteVar(tw, property, value.ToString(), escape);
     }
 }
            public sealed override void Write(ParsedLayout layout, TextWriter tw, LoggerEvent evt)
            {
                if (formatCache == null)
                {
                    formatCache = string.Concat('{', '0',
                                                Padding == 0 ? string.Empty : ("," + Padding),
                                                string.IsNullOrWhiteSpace(Format) ? string.Empty : (":" + Format),
                                                '}');
                }

                layout.WriteVar(tw, VarName,
                                string.Format(formatCache, Evaluate(evt)),
                                Escape);
            }
            // TODO Generated output should be in prefix order
            void WriteNode(PropertyTree node,
                           ParsedLayout layout,
                           string prefix,
                           TextWriter tw,
                           int level)
            {
                if (level == 6 || !node.HasChildren)
                {
                    return;
                }

                string nodeName = node.Name;

                if (level == 0)
                {
                    nodeName = char.ToUpperInvariant(nodeName[0]) + nodeName.Substring(1);
                }
                string property = prefix + nodeName;

                StringBuilder s = new StringBuilder();

                foreach (var child in node.Children)
                {
                    if (child.IsPropertyTree)
                    {
                        WriteNode((PropertyTree)child, layout, property + ".", tw, level + 1);
                    }
                    else
                    {
                        s.Append(child.Name)
                        .Append("=")
                        .Append(child.Value)
                        .Append(s.Length > 0 ? "; " : string.Empty);
                    }
                }

                if (s.Length > 0)
                {
                    layout.WriteVar(tw, property, s.ToString(), false);
                }
            }