如何初始化规则表达式类

问题描述

我正在使用表达式开发规则引擎...想要为复合规则实现表达式...使用以下 stackoverflow 线程作为参考:How to implement a rule engine?

我不知道如何使用构造函数重载来初始化规则类,尤其是带有 3 个参数的构造函数...我希望这里的任何一位专家都能帮助我...

public class RuleExpression {
    public NodeOperator NodeOperator { get; set; }
    public List<RuleExpression> Expressions { get; set; }
    public Rule Rule { get; set; }

    public RuleExpression()
    {

    }
    public RuleExpression(Rule rule)
    {
        NodeOperator = NodeOperator.Leaf;
        Rule = rule;
    }

    public RuleExpression(NodeOperator nodeOperator,List<RuleExpression> expressions,Rule rule)
    {
        this.NodeOperator = nodeOperator;
        this.Expressions = expressions;
        this.Rule = rule;
    }
}


public enum NodeOperator
{
    And,Or,Leaf
}

感谢您的帮助...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)