fork(2) 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. var e = (Func<int?>)Expression.Lambda(
  9. typeof(Func<int?>)
  10. , Expression.Condition(
  11. Expression.Constant(false)
  12. , Expression.Default(typeof(int?))
  13. , Expression.Convert(Expression.Constant(1), typeof(int?))
  14. , typeof(int?)
  15. )
  16. ).Compile();
  17. Console.WriteLine("'{0}'", e());
  18. }
  19. }
Success #stdin #stdout 0.17s 25968KB
stdin
Standard input is empty
stdout
'1'