Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / mcs / tests / gtest-linq-02.cs
1
2
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
6
7 class Test
8 {
9         public static int Main ()
10         {
11                 int[] int_array = new int [] { 0, 1 };
12                 
13                 IEnumerable<int> e;
14                 int pos;
15
16                 // Explicitly typed
17                 e = from int i in int_array select i;
18                 pos = 0;
19                 foreach (int actual in e) {
20                         Console.WriteLine (actual);
21                         if (int_array [pos++] != actual)
22                                 return pos;
23                 }
24                 
25                 e = from int i in int_array select 19;
26                 pos = 0;
27                 foreach (int actual in e) {
28                         Console.WriteLine (actual);
29                         if (actual != 19)
30                                 return actual;
31                 }
32
33                 // Implicitly typed
34                 e = from i in int_array select i;
35                 pos = 0;
36                 foreach (int actual in e) {
37                         Console.WriteLine (actual);
38                         if (int_array [pos++] != actual)
39                                 return pos;
40                 }
41                 
42                 e = from i in int_array select 19;
43                 pos = 0;
44                 foreach (int actual in e) {
45                         Console.WriteLine (actual);
46                         if (actual != 19)
47                                 return actual;
48                 }
49                 
50                 Console.WriteLine ("OK");
51                 return 0;
52         }
53 }