linq where in 排序

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

猜你喜欢

转载自www.cnblogs.com/gaocong/p/9126940.html