/// <summary> /// Dispatches to the specific visit method for this node type. For /// example, <see cref="MethodCallExpression" /> will call into /// <see cref="ExpressionVisitor.VisitMethodCall" />. /// </summary> /// <param name="visitor">The visitor to visit this node with.</param> /// <returns>The result of visiting this node.</returns> /// <remarks> /// This default implementation for <see cref="ExpressionType.Extension" /> /// nodes will call <see cref="ExpressionVisitor.VisitExtension" />. /// Override this method to call into a more specific method on a derived /// visitor class of ExpressionVisitor. However, it should still /// support unknown visitors by calling VisitExtension. /// </remarks> protected internal virtual Expression Accept(ExpressionVisitor visitor) { if (visitor == null) { throw new ArgumentNullException(nameof(visitor)); } return(visitor.VisitExtension(this)); }
/// <summary> /// Dispatches to the specific visit method for this node type. For /// example, <see cref="MethodCallExpression"/> will call into /// <see cref="ExpressionVisitor.VisitMethodCall"/>. /// </summary> /// <param name="visitor">The visitor to visit this node with.</param> /// <returns>The result of visiting this node.</returns> /// <remarks> /// This default implementation for <see cref="ExpressionType.Extension"/> /// nodes will call <see cref="ExpressionVisitor.VisitExtension"/>. /// Override this method to call into a more specific method on a derived /// visitor class of ExprressionVisitor. However, it should still /// support unknown visitors by calling VisitExtension. /// </remarks> protected internal virtual Expression Accept(ExpressionVisitor visitor) { return(visitor.VisitExtension(this)); }
/// <summary> /// Accepts the specified visitor, by default dispatching to <see cref="ExpressionVisitor.VisitExtension"/>. /// Inheritors of the <see cref="ExtensionExpression"/> class can override this method in order to dispatch to a specific Visit method. /// </summary> /// <param name="visitor">The visitor whose Visit method should be invoked.</param> /// <returns>The <see cref="Expression"/> returned by the visitor.</returns> /// <remarks> /// Overriders can test the <paramref name="visitor"/> for a specific interface. If the visitor supports the interface, the extension expression /// can dispatch to the respective strongly-typed Visit method declared in the interface. If it does not, the extension expression should call /// the base implementation of <see cref="Accept"/>, which will dispatch to <see cref="ExpressionVisitor.VisitExtension"/>. /// </remarks> protected virtual Expression Accept (ExpressionVisitor visitor) { ArgumentUtility.CheckNotNull ("visitor", visitor); return visitor.VisitExtension (this); }