void IDumpableAsText.DumpAsText(TextWriter writer) { var balancedCode = BalancedCode.IsEmpty() ? null : BalancedCode.Select(n => n.DumpAsText()).StringJoin(";" + Environment.NewLine); if (balancedCode != null && balancedCode.EndsWith(Environment.NewLine)) { balancedCode = balancedCode.Substring(0, balancedCode.Length - Environment.NewLine.Length); } var residue = Residue.IsEmpty() ? null : Residue.Select(e => "r: " + e.DumpAsText()).StringJoin(Environment.NewLine); var dump = new[] { Name, balancedCode, residue }.Where(s => s.IsNeitherNullNorEmpty()).StringJoin(Environment.NewLine); writer.Write(dump); }