本文整理汇总了C#中System.Linq.Expressions.ExpressionVisitor.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionVisitor.Visit方法的具体用法?C# ExpressionVisitor.Visit怎么用?C# ExpressionVisitor.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.ExpressionVisitor
的用法示例。
在下文中一共展示了ExpressionVisitor.Visit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitChildren
/// <summary>
/// Reduces the node and then calls the <see cref="ExpressionVisitor.Visit(System.Linq.Expressions.Expression)" /> method passing the
/// reduced expression.
/// Throws an exception if the node isn't reducible.
/// </summary>
/// <param name="visitor"> An instance of <see cref="ExpressionVisitor" />. </param>
/// <returns> The expression being visited, or an expression which should replace it in the tree. </returns>
/// <remarks>
/// Override this method to provide logic to walk the node's children.
/// A typical implementation will call visitor.Visit on each of its
/// children, and if any of them change, should return a new copy of
/// itself with the modified children.
/// </remarks>
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
visitor.Visit(_tableExpression);
visitor.Visit(_predicate);
return this;
}
示例2: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var newLeft = visitor.Visit(Left);
var newRight = visitor.Visit(Right);
return newLeft != Left || newRight != Right
? new StringCompareExpression(Operator, newLeft, newRight)
: this;
}
示例3: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var newMatchExpression = visitor.Visit(Match);
var newPatternExpression = visitor.Visit(Pattern);
return (newMatchExpression != Match)
|| (newPatternExpression != Pattern)
? new LikeExpression(newMatchExpression, newPatternExpression)
: this;
}
示例4: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var newMatchExpression = visitor.Visit(Match);
var newPatternExpression = visitor.Visit(Pattern);
return newMatchExpression != Match
|| newPatternExpression != Pattern
? new RegexMatchExpression(newMatchExpression, newPatternExpression, Options)
: this;
}
示例5: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
Expression left = visitor.Visit(_left);
Expression right = visitor.Visit(_right);
if (left != _left || right != _right) {
return new AssignmentExtensionExpression(left, right);
}
return this;
}
示例6: VisitChildren
/// <summary>
/// Loop in and make sure the sub-expressions are correctly "visited" - mainly the
/// low and high guys.
/// </summary>
/// <param name="visitor"></param>
/// <returns></returns>
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var nLowBoundary = visitor.Visit(LowBoundary);
var nHighBoundary = visitor.Visit(HighBoundary);
if (nLowBoundary == LowBoundary && nHighBoundary == HighBoundary)
{
return this;
}
// Changed, so clone ourselves.
return new EnumerableRangeExpression(nLowBoundary, nHighBoundary);
}
示例7: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
QueryNode newTarget = (QueryNode)visitor.Visit(Target);
LambdaExpression[] newConditions = new LambdaExpression[Conditions.Count];
bool unchanged = (newTarget == Target);
for (int i = 0; i < newConditions.Length; i++) {
newConditions[i] = (LambdaExpression)visitor.Visit(Conditions[i]);
unchanged &= newConditions[i] == Conditions[i];
}
if (unchanged)
return this;
else
return new Filter(newTarget, newConditions);
}
示例8: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
Expression v = visitor.Visit(_value);
if (v == _value) {
return this;
}
return Utils.MakeYield(_target, v, YieldMarker);
}
示例9: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
var instance = visitor.Visit(_expr);
if (instance != _expr) {
return new LightCheckAndThrowExpression(instance);
}
return this;
}
示例10: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
Expression v = visitor.Visit(_variable);
if (v == _variable) {
return this;
}
return Utils.Delete(v);
}
示例11: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
Expression b = visitor.Visit(_body);
if (b == _body) {
return this;
}
return new FinallyFlowControlExpression(b);
}
示例12: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
Expression body = visitor.Visit(_body);
if (body == _body) {
return this;
}
return new SkipInterpretExpression(body);
}
示例13: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
Expression v = visitor.Visit(_value);
if (v == _value) {
return this;
}
return Utils.Assign(_name, v);
}
示例14: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor) {
var expr = visitor.Visit(_expr);
if (expr != _expr) {
return new LightExceptionConvertingExpression(expr, _supportsLightEx);
}
return this;
}
示例15: VisitChildren
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var newInnerExpression = visitor.Visit(_expression);
return newInnerExpression != _expression
? new AliasExpression(Alias, newInnerExpression)
: this;
}