I'm quite new to all the .Net stuff and just wondering about something I would like to do.
I've been using for some time the LinQ Lambda queries to return list values with the Select statement, like this:
var data = list.Select((x, i) =>
new
{
Index = i, // <--- this is what I need!
Value = x.Value,
Text = x.Text
})
.ToList();
The thing is that I have a LinQ Lambda Join expression as it follows:
var data = DataBase.Table1
.Join(DataBase.Table2,
x => x.Id,
y => y.Id,
(x, y) => new // <--- I can't do the same here :(
{
Index = ???, // <--- Here is where I need the index!!
Value = x.Id,
Text = y.Description,
})
.OrderBy(x => x.Id)
.ToList();
My question is, how can I retrieve the index in this second linq query as I did in the first?
Selectwith index to SQL? I think you first query will not work.