linq where in 排序

Posted 小小高

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linq where in 排序相关的知识,希望对你有一定的参考价值。

List<INGREDIENT> selectedIngredients = db.INGREDIENT
                         .Where(i => model.SelectedIngredients.Contains(i.IngredientId))
                         .AsEnumerable()
                         .OrderBy(i => model.SelectedIngredients.IndexOf(i.IngredientId))
                         .ToList();

 

以上是关于linq where in 排序的主要内容,如果未能解决你的问题,请参考以下文章