Please help me convert this C# 2.0 snippet to Linq.
Posted
by Hamish Grubijan
on Stack Overflow
See other posts from Stack Overflow
or by Hamish Grubijan
Published on 2010-04-21T14:41:09Z
Indexed on
2010/04/21
14:43 UTC
Read the original article
Hit count: 174
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
}
© Stack Overflow or respective owner