Exemple #1
0
 public static string ExprToString(Expression expr) {
   Contract.Requires(expr != null);
   using (var wr = new System.IO.StringWriter()) {
     var pr = new Printer(wr);
     pr.PrintExpression(expr, false);
     return wr.ToString();
   }
 }
Exemple #2
0
 private static int GetExpressionLength(Expression expr)
 {
     var sw = new StringWriter();
     var printer = new Printer(sw);
     printer.PrintExpression(expr, false);
     return sw.ToString().Length;
 }