Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 22nd, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Looking for a C# => Linq Expression compiler
  2. public static int Add(int a, int b)
  3. {
  4.    return a + b;
  5. }
  6.        
  7. ParameterExpression a = Expression.Parameter(typeof(int), "a");
  8.     ParameterExpression b = Expression.Parameter(typeof(int), "b");
  9.     Expression<Func<int, int, int>> expectedExpression = Expression.Lambda<Func<int, int, int>>(
  10.             Expression.Add(a,b),
  11.             a,
  12.             b
  13.         );
  14.        
  15. Expression<Func<int,int,int>> expr = (a,b) => a + b;