本文整理汇总了C#中System.Linq.Expressions.UnaryExpression.Update方法的典型用法代码示例。如果您正苦于以下问题:C# UnaryExpression.Update方法的具体用法?C# UnaryExpression.Update怎么用?C# UnaryExpression.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.UnaryExpression
的用法示例。
在下文中一共展示了UnaryExpression.Update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitUnary
protected override Expression VisitUnary(UnaryExpression node)
{
if (node.NodeType == ExpressionType.ArrayLength) {
Expression expression = this.Visit(node.Operand);
//translate arraylength into normal member expression
return Expression.MakeMemberAccess(expression, expression.Type.GetRuntimeProperty("Length"));
} else if (node.NodeType == ExpressionType.Convert) {
return this.Visit(node.Operand);
} else {
return node.Update(this.Visit(node.Operand));
}
}
示例2: VisitUnary
protected override Expression VisitUnary(UnaryExpression node)
{
switch (node.NodeType)
{
case ExpressionType.ArrayLength:
var expression = this.Visit(node.Operand);
//translate arraylength into normal member expression
return Expression.MakeMemberAccess(expression, expression.Type.GetRuntimeProperty("Length"));
case ExpressionType.Convert:
return this.Visit(node.Operand);
default:
return node.Update(this.Visit(node.Operand));
}
}
示例3: VisitUnary
/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
protected override Expression VisitUnary(UnaryExpression node)
{
var operand = Visit(node.Operand);
if (!IsOptimalExpansion)
{
return node;
}
if (node.NodeType == ExpressionType.Not)
{
IsOptimalExpansion = false;
}
return node.Update(operand);
}
示例4: replaceUnaryNodeChild
private UnaryExpression replaceUnaryNodeChild(UnaryExpression node, Expression oldChild, Expression newChild)
{
return node.Update(newChild);
}