This is not a homework ;) I need to both A) optimize the following code (between a TODO and a ~TODO) and B) convert it to [P]Linq. Better readability is desired. It might make sense to provide answers to A) and B) separately. Thanks!
lock (Status.LockObj)
{
// TODO: find a better way to merge these dictionaries
foreach (KeyValuePair<Guid, Message> sInstance in newSInstanceDictionary)
{
this.sInstanceDictionary.Add(sInstance.Key, sInstance.Value);
}
foreach (KeyValuePair<Guid, Message> sOperation in newSOperationDictionary)
{
this.sOperationDictionary.Add(sOperation.Key, sOperation.Value);
}
// ~TODO
}
P.S. Check out my other, bounty question.