Simple code sample that provides a indexer for a foreach
.
The following works on SQL-Server Chinook database using EF Core
foreach (var (track, index) in ledZeppelinIvAlbum.Track.Select((track, index) => (t: track, i: index)))
{
Console.WriteLine($"{index,-4}{track.Name,-35}{track.Milliseconds.ShowTime(),-10}{track.Composer}");
}