I have a LINQ query that selects a list of teamIDs and team names to populate a drop down list. The query looks like this:
var teams = db.Teams.Where(t => t.isActive)
.Select(t => new {t.TeamID, t.TeamName});
However, I want the result set to be in the form of a 2D string array, since that's what my function that populates DDLs requires. I know I can use a for loop and build the array, but I'd prefer it, if possible to do it all in one step.
Is there something similar to this?
string[][] teams = db.Teams.Where(t => t.isActive)
.Select(t => new {t.TeamID, t.TeamName})
.To2DArray();