linq where in 排序

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

 

posted @ 2018-06-02 21:15  小小高  阅读(731)  评论(0编辑  收藏  举报