2009-07-16 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-linq-17.cs
blob231a62657647014733715aab80c5bf503849cddd
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
5 //
6 // Tests whether group i by i is optimized
7 //
8 class TestGroupBy
10 public static int Main ()
12 int[] int_array = new int [] { 0, 1, 2, 3, 4 };
14 var e = from i in int_array group i by i;
16 int c = 0;
17 foreach (var ig in e) {
18 Console.WriteLine (ig.Key);
19 if (ig.Key != c++)
20 return c;
23 Console.WriteLine ("OK");
24 return 0;