public static IValueOf getStrategy(Expression expr) { IValueOf strategy = ValueOfConst.clone(); if (expr is MemberExpression) { MemberExpression member = (MemberExpression)expr; if (member.Expression is MemberExpression) // expr là một property trong object { strategy = ValueOfObject.clone(); } else if (member.Expression is ConstantExpression) // expr là một biến { strategy = ValueOfVariable.clone(); } else { strategy = ValueOfDatetime.clone(); } } else if (expr is MethodCallExpression) // expr là 1 fuction { strategy = ValueOfMethod.clone(); } else if (expr is UnaryExpression) { strategy = ValueOfUnary.clone(); } return(strategy); }
public static ValueOfUnary clone() { if (value == null) { value = new ValueOfUnary(); } return(value); }