次のような「where句」を適用するコードがあります。
データベーステーブルの例として「n」を入れました。
List<KeyValuePair<int, int>> n = new List<KeyValuePair<int, int>>();
n.Add(new KeyValuePair<int, int>(1,2));
n.Add(new KeyValuePair<int, int>(1,3));
n.Add(new KeyValuePair<int, int>(4,6));
n.Add(new KeyValuePair<int, int>(4,3));
n.Add(new KeyValuePair<int, int>(5,3));
var zzz = n.Where(z => z.Key == 1); // this returns "1,2" and "1,3"
それから私のコードのどこかで私はこれをしました:
zzz.Where(x => x.Value == 3); // this should return "1,3"... Instead it seems to return "4,3" and "5,3" and "1,3".
2 番目の Where は "1,3" のみを返すはずではないですか? 2 番目の Where 句は、"zzz" の結果に適用する必要がありますね。