2009-07-16 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-linq-02.cs
blob290ea8feca9dcd5d80d0615b5aeaf99f97a9f840
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
7 class Test
9 public static int Main ()
11 int[] int_array = new int [] { 0, 1 };
13 IEnumerable<int> e;
14 int pos;
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;
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;
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;
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;
50 Console.WriteLine ("OK");
51 return 0;