1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Linq.Expressions; 5 6 namespace Mono 7 { 8 class C 9 { Main()10 public static int Main () 11 { 12 int[] i2 = new int [] { 10, 14 }; 13 14 Expression<Func<IEnumerable<int>>> e = () => from i in i2 select i; 15 int sum = e.Compile () ().Sum (); 16 if (sum != 24) 17 return 1; 18 19 Expression<Func<IEnumerable<long>>> e2 = () => from i in GetValues () select i; 20 var s2 = e2.Compile () ().Sum (); 21 if (s2 != 14) 22 return 2; 23 24 return 0; 25 } 26 GetValues()27 static long[] GetValues () 28 { 29 return new long [] { 9, 2, 3 }; 30 } 31 } 32 } 33 34