-6
次は私のLINQの式である:私はいくつかのlinqの構文で私を助けることができますか?
return from c in db.RecipeIngredients
join d in db.Ingredients on c.IngredientID equals d.IngredientsID
where c.RecipeID.Equals(recipeID)
select (d.IngredientsID,c.Unit,c.IngredientID,c.Amount).ToList();
これは成分情報の列のリストを返すべきです。これが返すタイプは何ですか?今、firstRow.ingredientNameなどを使用するにはどうしたらいいですか?あなたはそのすべての変数と宣言型のタプルですC#7.0、にしている場合(d.IngredientsID,c.Unit,c.IngredientID,c.Amount)
、次、
return (from c in db.RecipeIngredients
join d in db.Ingredients on c.IngredientID equals d.IngredientsID
where c.RecipeID.Equals(recipeID)
select (d.IngredientsID,c.Unit,c.IngredientID,c.Amount)).ToList();
OK:
をコンパイルしていますか?いくつかのアイデアについては、次の記事を見てください:https://stackoverflow.com/questions/534690/return-anonymous-type-results –
あなたは[ask]を読んで[tour]を取るべきです。スコアが0以下のものすべてを含む6つの投稿は、すぐに参加を制限します。 – Plutonix