Merge pull request #4928 from kumpera/ptr_to_struct_intrinsic
[mono.git] / mcs / tests / gtest-linq-06.cs
1
2
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
6
7 class Let
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
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;
25                 }               
26                 
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;
38                 }
39                 
40                 Console.WriteLine ("OK");
41                 return 0;
42         }
43 }