Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Do This With Linq
Message
From
24/05/2010 21:05:23
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01465788
Message ID:
01465801
Views:
68
>I have a collection of objects called Groups which have a Sequence property. I'd like to get back the highest sequence. How can I do
>this with Linq?
>
>I tried this, but it doesn't recognize Max:
>
>
>var group = Manager.Root.Groups.Max(x => x.Sequence);
>
>
>I thought this was it http://msdn.microsoft.com/en-us/library/system.linq.enumerable.max.aspx
>
>but I guess I'm wrong.

I don't have intellisense right now, but I think you want OrderByDescending(x => x.Sequence) coupled with Take(1).
Very fitting: http://xkcd.com/386/
Previous
Reply
Map
View

Click here to load this message in the networking platform