【发布时间】:2014-10-03 13:13:08
【问题描述】:
假设我有这本字典:
ConcurrentDictionary<string, Location> connections;
我想从这本字典中获取与它们的值的某些条件匹配的键的列表。例如,这对我有用:
List<string> users = connections.Where(x.Value.IsNearby(anotherLocation)).ToDictionary(x => x.Key, x => x.Value).Keys.ToList();
但这很讨厌,因为它从字典到子字典,再到键列表。有没有更优雅的方式来做到这一点?
【问题讨论】:
标签: c# .net list dictionary type-conversion