/// <summary> /// Starting from a simple expression, do the translation /// </summary> /// <param name="expression"></param> /// <returns></returns> public static string Format(Expression expression, bool useUniqueHashCodes = false) { if (expression == null) throw new ArgumentNullException("expression"); var transformedExpression = new ExpressionStringConverter(useUniqueHashCodes).Visit(expression); return transformedExpression.ToString(); }
/// <summary> /// Starting from a simple expression, do the translation /// </summary> /// <param name="expression"></param> /// <returns></returns> public static string Format(Expression expression, bool useUniqueHashCodes = false) { if (expression == null) { throw new ArgumentNullException("expression"); } var transformedExpression = new ExpressionStringConverter(useUniqueHashCodes).Visit(expression); return(transformedExpression.ToString()); }
public void TestSameWithHashCodes() { /// Loop through the pairs of expressions and make sure they are the same when cvt to string. foreach (var item in SameExpressionsHC) { var s1 = ExpressionStringConverter.Format(item.Item1, true); var s2 = ExpressionStringConverter.Format(item.Item2, true); Console.WriteLine("s1 = '{0}' s2 = '{1}'", s1, s2); Assert.AreEqual(s1, s2, "Didn't expect '" + s1 + "' == '" + s2 + "'"); } }