I want to know if it's possible to get a List<IGrouping<string, IGrouping<string, T>>>
out of a Linq expression. What I want to do is order songs by genre and artist, but in a format where I can iterate through each genre and for every genre, iterate for each album. If it's possible how can it be done? Or is there a better approach to what I want to achieve?
Here's my Song class
public class Song
{
[StringLength(100)]
public string Album { get; set; }
public int Id { get; set; }
[StringLength(100)]
public string Title { get; set; }
[StringLength(100)]
public string Genre { get; set; }
[StringLength(255)]
public string Comment { get; set; }
[StringLength(4)]
public string Year { get; set; }
[StringLength(100)]
public string Author { get; set; }
public int Length { get; set; }
[StringLength(255)]
public string Photo { get; set; }
[StringLength(255)]
public string FileName { get; set; }
public string Extension { get; set; }
}
And this query I had here
var songs = db.Songs.GroupBy(s => s.Genre).ToList();
gives me a List<IGrouping<string, Song>>
but what I want is to further group by Artist.