471,310 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Correct LINQ syntax for MinElements

What is the correct syntax for the Min Elements LINQ example on this
page :

http://msdn.microsoft.com/en-us/vcsharp/aa336747.aspx

(You will need to scroll down to find the Min Elements example, as the
link to this from the main page doesn't work)
*** Sent via Developersdex http://www.developersdex.com ***
Sep 3 '08 #1
1 1042
Mike P wrote:
What is the correct syntax for the Min Elements LINQ example on this
page :

http://msdn.microsoft.com/en-us/vcsharp/aa336747.aspx
var categories =
from p in products
group p by p.Category into g
let minPrice = g.Min(p =p.UnitPrice)
select new {Category = g.Key, CheapestProducts = g.Where(p =>
p.UnitPrice == minPrice)};

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Sep 3 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Chris | last post: by
5 posts views Thread by =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post: by
9 posts views Thread by Cirene | last post: by
21 posts views Thread by hrishy | last post: by
1 post views Thread by hrishy | last post: by
4 posts views Thread by CSharper | last post: by
3 posts views Thread by bob laughland | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.