コード例 #1
0
        public static bool TryCreate(
            Expression unary,
            Expression root,
            out UnaryExpressionCloner result)
        {
            if (unary == null)
            {
                result = null;
                return(false);
            }

            Expression expr = unary;

            do
            {
                // Check if we reached the root expression
                if (expr == root)
                {
                    result = new UnaryExpressionCloner(unary, root);
                    return(true);
                }
            }while (TryGetNextStep(expr, out expr));

            // Last chance: check for a default root node
            if (root == null && IsValidDefaultNode(expr))
            {
                result = new UnaryExpressionCloner(unary, expr);
                return(true);
            }

            result = null;
            return(false);
        }
コード例 #2
0
ファイル: UnaryExpressionCloner.cs プロジェクト: nozerowu/ABP
        public static bool TryCreate(
            Expression unary, 
            Expression root, 
            out UnaryExpressionCloner result)
        {
            if (unary == null)
            {
                result = null;
                return false;
            }

            Expression expr = unary;

            do
            {
                // Check if we reached the root expression
                if (expr == root)
                {
                    result = new UnaryExpressionCloner(unary, root);
                    return true;
                }
            }
            while (TryGetNextStep(expr, out expr)) ;

            // Last chance: check for a default root node
            if (root == null && IsValidDefaultNode(expr))
            {
                result = new UnaryExpressionCloner(unary, expr);
                return true;
            }

            result = null;
            return false;
        }