この LINQ 式は機能していません。
dt.AsEnumerable().ToDictionary<Int64, List<string>> (
dtRow => dtRow.Field<Int64>("CodeVal_1"),
new List<string> {
dtRow => dtRow.Field<string>("CodeVal_2"),
dtRow => dtRow.Field<string>("CountryCode")
}
);
dt
は でありDataTable
、 への参照を追加しましたDataSetExtensions
。
ここに完全なコード
using (DataSet dsIps = DbConnection.db_Select_Query("use mydb select * from tblCountryCodes"))
{
using (DataTable dt = dsIps.Tables[0])
{
dt.AsEnumerable().ToDictionary<Int64, List<string>>(
dtRow => dtRow.Field<Int64>("CodeVal_1"),
new List<string> {
dtRow => dtRow.Field<string>("CodeVal_2"),
dtRow => dtRow.Field<string>("CountryCode")
}
);
}
}
エラーリスト