我有两个不同的字典:

Dictionary<int, User> X;
Dictionary<int, User> Y;

我想使用 LINQ 从他们那里获取相同键的列表。

最佳答案

var sameKeys = X.Keys.Intersect(Y.Keys).ToList();

关于c# - 从两个不同的字典中获取相同的键,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13541586/

10-16 07:38