Is the null coalesce operator thread safe?
So this is the meat of the question: Can Foo.Bar ever return null? To clarify, can '_bar' be set to null after it's evaluated as non-null and before it's value is returned? public class Foo { Object _bar; public Object Bar { get { return _bar ?? new Object(); } set { _bar = value; } } } I know using the following get method is not safe, and can return a null value: get { return _bar != null ? _bar : new Object(); } UPDATE: Another way to look at the same problem, this example might be more clear: public static T GetValue<T>(ref T value) where T : class, new() { return value ?? new T(); } And