Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
簡単なLinqクエリがあります:
Linq
var dict = (from i in Customers select i).ToDictionary(i => i.Id1, i => i.Id2);
クエリが言うがLinq2sql、選択を 2 つのフィールド () に削減することを知っていますか?Id1, Id2select i
Linq2sql
Id1, Id2
select i
私の知る限り、そうではありません。クエリを評価し、テーブルのすべてのフィールドを取得しCustomersます。
Customers
次のように書き換えることができます。
var dict = ( from i in Customers select new { i.Id1, i.Id2 }) .ToDictionary(i => i.Id1, i => i.Id2);