Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I sort correctly?
Message
 
 
À
Tous
Information générale
Forum:
C#
Catégorie:
LINQ
Titre:
How can I sort correctly?
Divers
Thread ID:
01652557
Message ID:
01652557
Vues:
59
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform