Merge pull request #495 from nicolas-raoul/fix-for-issue2907-with-no-formatting-changes
[mono.git] / mcs / tests / gtest-linq-18.cs
1 using System;
2 using System.Linq;
3
4 // LINQ and lambdas mix tests
5
6 public class C
7 {
8         static bool Test (Func<int, bool> f)
9         {
10                 return false;
11         }
12         
13         static bool Test2 (Func<int, int> f)
14         {
15                 return false;
16         }
17
18         public static int Main ()
19         {
20                 var x = new int [] { 'a', 'b', 'c' };
21                 
22                 var e = from ck in x
23                         let xy = Test(c => c == ck)
24                         where ck == 'v'
25                         select Test(c => c == ck);
26
27                 var e2 = from ck in x
28                         where Test(c => c == ck)
29                         select Test(c => c == ck);
30         
31                 int[] int_array = new int [] { 0, 1, 2, 3, 4 };
32                 var e3 = from int i in int_array group Test2 (gg => i + 2) by Test2 (g => i % 2);
33
34                 var e4 = from i in x
35                         let l = i + 4
36                         let g = l - 2
37                         where Test(c => c == l)
38                         where l > 0
39                         select l;
40                         
41                 var e5 = from a in x
42                         join b in x on Test (a2 => a2 == a) equals Test (b2 => b2 == b)
43                         select a;
44                         
45                 var e6 = from a in x
46                         join b in x on Test (a2 => a2 == a) equals Test (b2 => b2 == b) into re6
47                         select a;
48         
49                 return 0;
50         }
51 }