public static IEnumerable <CriteriaOperator> GetOperators(this CriteriaOperator criteriaOperator) { if (criteriaOperator is FunctionOperator) { return((IEnumerable <CriteriaOperator>)criteriaOperator.GetPropertyValue("Operands")); } var binaryOperator = criteriaOperator as BinaryOperator; if (binaryOperator != null) { return new[] { binaryOperator.LeftOperand, binaryOperator.RightOperand } } ; var unaryOperator = criteriaOperator as UnaryOperator; if (unaryOperator != null) { return(unaryOperator.Operand.GetOperators()); } var betweenOperator = criteriaOperator as BetweenOperator; if (betweenOperator != null) { return new[] { betweenOperator.TestExpression, betweenOperator.BeginExpression, betweenOperator.EndExpression } } ; return(Enumerable.Empty <CriteriaOperator>()); }