Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-lambda-22.cs
1 using System.Linq;
2
3 //
4 // This is a lambda test for situation when parent is infering return types and child not
5 //
6
7 public class Product
8 {
9         public int CategoryID;
10         public decimal UnitPrice;
11 }
12
13 class MainClass
14 {
15         public static void Main ()
16         {
17                 Product[] products = new[] {
18                         new Product { CategoryID = 1, UnitPrice = 1m }
19                 };
20
21                 var categories = from p in products
22                                                  group p by p.CategoryID into g
23                                                  select new {
24                                                          g,
25                                                          ExpensiveProducts = from p2 in g
26                                                                                                  where (p2.UnitPrice > g.Average (p3 => p3.UnitPrice))
27                                                                                                  select p2
28                                                  };
29         }
30 }