PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 02?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database.
You create the classes shown in the following exhibit.
You add the following code segment to the application. (Line numbers are included for reference only.)
01 public void QueryPlayers(List <League> leagues) {
02
03 }
You create a LINQ query to retrieve a collection of Player objects.
You need to ensure that the collection includes all the players from each team and every league.
Which code segment should you insert at line 02?

PrepAway - Latest Free Exam Questions & Answers

A.
var query = leagues.Select(l => l.Teams.Select(t => t.Players));

B.
var query = leagues.Select(l => l.Teams.SelectMany(t => t.Players));

C.
var query = leagues.SelectMany(l => l.Teams.SelectMany(t => t.Players));

D.
var query = leagues.SelectMany(l => l.Teams.Select(t => t.Players));


Leave a Reply