private string DebuggerToString() { var builder = new StringBuilder(); builder.Append(Label); builder.Append(" d:"); builder.Append(PathDepth); builder.Append(" m:"); builder.Append(Matches.Count); builder.Append(" c: "); builder.Append(string.Join(", ", Literals.Select(kvp => $"{kvp.Key}->({FormatNode(kvp.Value)})"))); return(builder.ToString()); // DfaNodes can be self-referential, don't traverse cycles. string FormatNode(DfaNode other) { return(ReferenceEquals(this, other) ? "this" : other.DebuggerToString()); } }