The System.Linq.Expressions.ExpressionVisitor
has a method named VisitExtension
which seems to do nothing other than call the VisitChildren
method on the Expression
being visited.
protected internal virtual Expression VisitExtension(Expression node)
{
return node.VisitChildren(this);
}
I understand what the VisitChildren
does. I also understand that this virtual implementation can be and is perhaps meant to be overriden. So I gather from the documentation of the method on MSDN, which is sparing in words and briefly remarks:
Visits the children of the extension expression. This can be overridden to visit or rewrite specific extension nodes. If it is not overridden, this method will call VisitChildren, which gives the node a chance to walk its children. By default, VisitChildren will try to reduce the node.
I do not find this explanation helpful. Specifically, the phrase that jets me out of my abilities of comprehension is "or rewrite specific extension nodes."
I understand the rest of it, which pertains to the reduction or breaking down of the expression into sub-expressions.
Also in the same namespace is an enumeration named ExpressionType
, the purpose of which I understand very well. But of all its members, there is one member named Extension
which I cannot map to any syntactical token I am currently aware of.
The documentation in this instance, too, is frustratingly laconic. It describes the value Extension
as follows:
An extension expression.
It is obvious that the two -- ExpressionType.Extension
and ExpressionVisitor.VisitExtension
-- are related.
But what is an extension? Surely, as is glaringly obvious, extension methods have no place in this context. Which syntactical artifact does the expression extension refer to here?