Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I sort correctly?
Message
 
 
To
All
General information
Forum:
C#
Category:
LINQ
Title:
How can I sort correctly?
Miscellaneous
Thread ID:
01652557
Message ID:
01652557
Views:
58
Hi everybody,

I wrote this code, but it has one flaw and I don't see a way to solve it:
var items = _itemAdapter.GetAllList().Where(i => modifierGroup.ModGrpLnk.Any(m => m.ItemId == i.ItemId)).ToList();
So, the modifierGroup comes with the list of ModGrpLnk entries attached to it. This ModGrpLnk class has SortOrder column. I'd like to return items belonging to the modifier group sorted according to that SortOrder.

Unfortunately, I don't see a simple way of modifying the above LINQ query to return items in the right order.

Do you see what can I do here?

Thanks in advance.

UPDATE. I think I need a JOIN query here and not the way I wrote it. I'll try to find some JOIN Linq query examples to write what I need.
UPDATE2. Apparently I had examples of that JOIN query already, so I just used it, testing now.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform