trygetvalue

How can I make this Dictionary TryGetValue code more readable?

I'd like to test if an id was not yet known or, if it is known, if the associated value has changed. I'm currently using code similar to this, but it is hard to understand for those not familiar with the pattern. Can you think of a way to make it more readable while keeping it short in LOC? string id; string actual; string stored; if (...

Using TryGetValue() in LINQ?

This code works, but is inefficient because it double-lookups the ignored dictionary. How can I use the dictionary TryGetValue() method in the LINQ statement to make it more efficient? IDictionary<int, DateTime> records = ... IDictionary<int, ISet<DateTime>> ignored = ... var result = from r in records where !ignored.Cont...