私は国=>リーグ=>チーム(名前、スコア)を持っています
国からすべてのチームの Name-Scores を選択する必要があります。
このようなものは機能しません)
query = from ligue in myCountry.Ligues, from team in ligue.Teams select name = team.Name , score = team.Score distinct
編集:
VB.NET 構文が推奨されます。
私は国=>リーグ=>チーム(名前、スコア)を持っています
国からすべてのチームの Name-Scores を選択する必要があります。
このようなものは機能しません)
query = from ligue in myCountry.Ligues, from team in ligue.Teams select name = team.Name , score = team.Score distinct
編集:
VB.NET 構文が推奨されます。
単純な Select / SelectMany を実行できるはずです
context.Countries.Single(c => c.CountryName == "My Country")
.Ligues.SelectMany(ligue => ligue.Teams
.Select(team => new { team.Name, team.Score }))
.Distinct();
VB10 拡張メソッドの構文に変換された Kirk のコードを次に示します。
dim result = context.Countries.Single(Function(c) c.CountryName = "My Country").
Ligues.SelectMany(Function(ligue) ligue.Teams).
Select(Function(team) new with {team.Name, team.Score }).
Distinct()
このvb.netクエリ構文のように書くことができると思います(ただし、今はVBコンパイラにアクセスできません)。
(EDIT 私の元のトライアルは確かに間違っていたので、以下のクエリを修正しました:)
dim result = From ligue in myCountry.Ligues
From team in ligue.Teams
Select team.Name, team.Score Distinct
Kirk のコードを使用した jeroenh のコードを使用すると、ここに作業バージョン (VB.NET) があります。
Dim query = From ligue In myCountry.Ligues
From team In ligue.Teams
Select Name = team.Name, Score = team.Score
Distinct