If I have this ConcurrentDictionary:
public class User
{
public string Context { get; set; }
public bool Owner { get; set; }
}
protected static ConcurrentDictionary<User, string> OnlineUsers = new ConcurrentDictionary<User, string>();
Does anyone know how I would get the value of Owner
if I already have the value of the Context
? Basically I want to do a "find" using the Context
. Thanks.
Does anything stop you from using standard Linq FirstOrDefault()
method like so:
var item = OnlineUsers.FirstOrDefault(kvp => kvp.Key.Context == myContext);