I have a concurrentdictionary of > lets say object as Artifact.
I wanted to add a new object. The object usually contains list of keys and I have a function to get those keys.
I know how to add to the dictionary if the key doesn't exist but I am not sure how to update the List if the key is already there. Any help would be greatly appreciated
public bool AddToken(Artifact artifact)
{
IList<string> terms = GetTerms(artifact);
foreach(var term in terms)
{
if (ExistsTerm(term))
{
termDictionary.AddOrUpdate(??)
}else
{
IList<Artifact> a = new List<Artifact>();
a.Add(artifact);
termDictionary.TryAdd(term, artifact);
}
}
return true;
}