【发布时间】:2012-09-21 19:26:35
【问题描述】:
如果我有这个 ConcurrentDictionary:
public class User
{
public string Context { get; set; }
public bool Owner { get; set; }
}
protected static ConcurrentDictionary<User, string> OnlineUsers = new ConcurrentDictionary<User, string>();
如果我已经拥有Context 的值,有谁知道我将如何获得Owner 的值?基本上我想使用Context 进行“查找”。谢谢。
【问题讨论】:
-
会不会有多个 User 对象具有相同的 Context,如果是,您想获取所有对象吗?
-
没有。上下文对每个用户都是唯一的。 :)