For ease of use and better performance, I would suggest using a combination of Dictionary and HashSet:
var KPDict = new Dictionary<string, HashSet<long>>();
Then it will provide you with the search complexity of O (1) + O (1) and a convenient check of the value:
if (KPDict.ContainsKey(keyp) && KPDict[keyp].Contains(valuep)) {
//do some actions
}
else{
//some logic in case keyp, valuep pair not found in KPDict
}
source
share