I've a KeyValuePair
list use to store some info from incoming message.
List<KeyValuePair<int, string>> qInfoTempList = new List<KeyValuePair<int, string>>();
qInfoTempList.Add(new KeyValuePair<int, string>(eventInfo.ReferenceId, eventInfo.StringValue));
Once the messages come in, the message's reference id stores as key and the message's selected value stores as value in the list. How can I detect a duplicated key on the spot and delete the earlier one in the list?
In this case, is it better to use Dictionary
instead of List
?