bring Mono Security to monotouch
[mcs.git] / tests / gtest-linq-06.cs
blob747c0903087f075a2bcace18404bc752500b737a
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
7 class Let
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
18 let u = i * 2
19 select u;
20 pos = 0;
21 foreach (int actual in e) {
22 Console.WriteLine (actual);
23 if (int_array [pos++] * 2 != actual)
24 return pos;
27 // Implicitly typed
28 e = from i in int_array
29 let u = i * 2
30 let v = u * 3
31 where u != 0
32 select v;
33 pos = 1;
34 foreach (int actual in e) {
35 Console.WriteLine (actual);
36 if (int_array [pos++] * 6 != actual)
37 return pos;
40 Console.WriteLine ("OK");
41 return 0;