fork download
  1. using System;
  2. using System.Linq;
  3. using System.Linq.Expressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. Func<int, object> hexConverter = x => "Value is " + x.ToString("X");
  10.  
  11. Console.WriteLine("{0}", hexConverter(36));
  12.  
  13. Expression<Func<int, object>> hexConverterExpression = x => "Good number is " + x.ToString("X");
  14.  
  15. Func<int, object> hexConverterToo = hexConverterExpression.Compile();
  16.  
  17. Console.WriteLine("{0}", hexConverterToo(36));
  18.  
  19. }
  20. }
Success #stdin #stdout 0.08s 35368KB
stdin
Standard input is empty
stdout
Value is 24
Good number is 24