I need a compound key (two strings) as my lookup value for a dictionary. I was thinking I could use a Tuple<string,string>
for this, but as I understand it, the dictionary would perform a reference equality check, and I'd never get a match.
What can I do so that it will perform an actual string comparison?
Here's what I've got:
protected Dictionary<Tuple<string, string>, WopiSession> _sessions;
...
var sessionKey = new Tuple<string, string>(accessToken, fileToken);
WopiSession session;
if (!_sessions.TryGetValue(sessionKey, out session))
{
session = new WopiSession();
_sessions.Add(sessionKey, session);
}