public static TValue TryGetValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key) where TValue : class { TValue val; dictionary.TryGetValue(key, out val); return val; }
The return value will be null if the key doesn't exist. This will also be the case if there is a key with a null value, but often you don't care about the distinction.
Since the hateful "out" is gone, you can now use the method directly in expressions.
Value val = dictionary.TryGetValue(key);
return dictionary.TryGetValue(key);
other.Foo = replacementFoos.TryGetValue(fooKey) ?? other.Foo;