Add a more functional (i.e. fewer-stubs) implementation of System.Data.Linq.
[mono.git] / mcs / tests / gtest-linq-12.cs
1 using System;\r
2 using System.Linq;\r
3 \r
4 class NestedQuery\r
5 {\r
6         public void XX ()\r
7         {\r
8                 var enumerable = new string[] { "aba", "bbb", "bab", "aaa" }.\r
9                         Select((values) => new { values = values, length = values.Length }).\r
10                                 Select((ti0) => ti0.values.Select ((type) => new { type = type, x = 9 }).Where((ti1) => (ti0.length == 3)).\r
11                         Select((ti1) => ti1.type));\r
12         }\r
13         \r
14         public static int Main ()\r
15         {\r
16                 var e = from values in new [] { "aba", "bbb", "bab", "aaa" }\r
17                         where values.Length > 0\r
18                         select from type in values\r
19                                 where type == 'a'\r
20                                 select type;\r
21                 \r
22                 int counter = 0;\r
23                 foreach (var v in e)\r
24                         foreach (var vv in v) {\r
25                                 ++counter;\r
26                                 Console.WriteLine (vv);\r
27                         }\r
28                         \r
29                 \r
30                 if (counter != 6)\r
31                         return 1;\r
32                         \r
33                 e = from values in new [] { "aba", "bbb", "bab", "aaa" }\r
34                         let length = values.Length\r
35                         select from type in values\r
36                                 let x = 9\r
37                                 where length == 3\r
38                                 select type;\r
39                 counter = 0;\r
40                 foreach (var v in e)\r
41                         foreach (var vv in v) {\r
42                                 ++counter;\r
43                                 Console.WriteLine (vv);\r
44                         }\r
45                         \r
46                 if (counter != 12)\r
47                         return 2;\r
48                         \r
49                 return 0;\r
50         }\r
51 }\r