Skip to content

CompositeVisitor<TContext, TBaseNode, TResult> Class ​

Definition ​

A Visitor<TContext, TNode, TResult> built from multiple other visitors that visit specific node types. When a node is visited the visitor with the most specific type for the node will be used. If no suitable visitor is found an InvalidOperationException is thrown; register a visitor for the base node type to provide a fallback instead.

c#
public sealed class CompositeVisitor<TContext, TBaseNode, TResult> : Visitor<TContext, TBaseNode, TResult>, ICompositeVisitorBuilder<TContext, TBaseNode, TResult>
   where TBaseNode : Node<TBaseNode>

View source

Type Parameters ​

NameDescription
TContextThe type of the context object.
TBaseNodeThe base type of all nodes in the tree.
TResultThe type of the result of visiting a node.

Methods ​

NameDescription
Build()Fluent interface to build a CompositeVisitor<TContext, TBaseNode, TResult>.
VisitNode(TContext, TBaseNode)Called to visit a node.