コード例 #1
0
        /// <summary>
        /// 获取操作符
        /// </summary>
        /// <param name="node">表达式</param>
        /// <returns></returns>
        internal static string GetOperator(this UnaryExpression node)
        {
            if (node is null)
            {
                return(string.Empty);
            }
            switch (node.NodeType)
            {
            case ExpressionType.Negate:
            case ExpressionType.NegateChecked:
                return("-");

            case ExpressionType.UnaryPlus:
                return("+");

            case ExpressionType.Not:
                return(node.IsBoolean() ? "NOT" : "~");

            default:
                return(string.Empty);
            }
        }