Files
mono/mcs/tests/gtest-lambda-22.cs
T
Marek Safar 907bca6614 Use correct naming, add 4.0 profile
svn path=/trunk/mcs/; revision=138957
2009-07-29 13:53:27 +00:00

31 lines
583 B
C#

using System.Linq;
//
// This is a lambda test for situation when parent is infering return types and child not
//
public class Product
{
public int CategoryID;
public decimal UnitPrice;
}
class MainClass
{
public static void Main ()
{
Product[] products = new[] {
new Product { CategoryID = 1, UnitPrice = 1m }
};
var categories = from p in products
group p by p.CategoryID into g
select new {
g,
ExpensiveProducts = from p2 in g
where (p2.UnitPrice > g.Average (p3 => p3.UnitPrice))
select p2
};
}
}