ExpressionTreeToString icon indicating copy to clipboard operation
ExpressionTreeToString copied to clipboard

Extensibility: allow for types not derived from Expression or other types in System.Linq.Expressions

Open zspitz opened this issue 5 years ago • 0 comments

Currently, in order to figure out which object is a node while visiting, we use a List<Type> for node types:

public readonly static List<Type> NodeTypes = new List<Type>() {
    typeof(Expression),
    typeof(MemberBinding),
    typeof(ElementInit),
    typeof(SwitchCase),
    typeof(CatchBlock),
    typeof(LabelTarget)
};

and a corresponding List<Type> which includes IEnumerable<> variants of each of these types. This allows visitors to treat non-Expression-derived types (such as SwitchCase or ElementInit) as nodes.

Authors of third-party extension visitors might have similar custom nodes which don't derive from Expression.

zspitz avatar Aug 26 '20 08:08 zspitz