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)); }
public static string Visit(this Expression target) { if (target == null) { throw new ArgumentNullException("target"); } var visitor = new ValidationExpressionVisitor(); visitor.Visit(target); return(visitor.Expression); }