src/DotNetCommon.Core/Expressions/Base/BinaryVisit.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace DotNetCommon.Expressions.Base
{
internal class BinaryVisit : BaseVisit
{
protected virtual string MarkString => throw new NotImplementedException();
protected override void Prepare(ExpressionNode node)
{
var binary = node.Expression as BinaryExpression;
node.Children.Add(new ExpressionNode
{
Children = new List<ExpressionNode>(),
Expression = binary.Left,
Parent = node
});
node.Children.Add(new ExpressionNode
{
Children = new List<ExpressionNode>(),
Expression = binary.Right,
Parent = node
});
}
protected override string GenerateFullMarkString(ExpressionNode node)
{
return $"{node.Children[0].FullMarkString} {MarkString} {node.Children[1].FullMarkString}";
}
internal override Expression Rebuild(ExpressionNode node)
{
var binary = node.Expression as BinaryExpression;
return binary.Update(node.Children[0].Expression, binary.Conversion, node.Children[1].Expression);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
