本文整理匯總了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);
}