public static StringBuilder AppendFormatting(IEnumerable <IGraphNode> nodes, NodeMetadata metadata) { void ProcessNode(IGraphNode node_, NodeMetadata metadata_, StringBuilder result_) { var genericTypeDefinition = node_.GetType().GetGenericTypeDefinition(); if (!PipeAppendersByType.ContainsKey(genericTypeDefinition)) { throw new NotImplementedException( $@"No DotGraph formatting for {node_.GetType().ToReadableString()}"); } PipeAppendersByType[genericTypeDefinition](node_, metadata_, result_); } var result = new StringBuilder(); foreach (var node in nodes) { DotGraph.ProcessTree(node, result, ProcessNode, delegate { }, metadata); } return(result); }