I have a table in sql server with the following structure.
tblFruit:
╔════╦══════════════╦══════╗
║ Id ║ Fruit ║ Color║
╠════╬══════════════╬══════╣
║ 1 ║ Peacock ║ Red ║
║ 2 ║ Hawk ║ Green║
║ 3 ║ Lion ║ Red ║
║ 4 ║ Lizard ║ Red ║
╚════╩══════════════╩══════╝
This is my query in LINQ :
db.Fruits.Where(r => r.Color == "Red")
.Select(r => r.Fruit)
.ToList()
I will get 3 rows of result from the table.
However I need the result to be Peacock,Lion,Lizard. Is there a way of getting this from LINQ or should I use a foreach loop and concatenate manually?