예제 #1
0
파일: Demand.cs 프로젝트: joshampton/Demand
        public static Target <TargetType> That <TargetType>(Expression <Func <TargetType> > targetSelector)
        {
            var visitor = new ValidationExpressionVisitor();

            visitor.Visit(targetSelector);

            var compiled = targetSelector.Compile();
            var value    = compiled.Invoke();

            return(new Target <TargetType>(visitor.Expression, value));
        }
예제 #2
0
        public static string Visit(this Expression target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var visitor = new ValidationExpressionVisitor();

            visitor.Visit(target);

            return(visitor.Expression);
        }