Thread-safe generic field
===

I have a generic field and a property that encapsulates it:

    T item;

    public T Item
    {
        get { return item; }
        set { item = value; }
    }

The problem is that this property can be written to from one thread and read from multiple threads at the same time. And if `T` is a `struct`, or `long`, readers might get results that are part old value and part new value. How can I prevent that?

I tried using `volatile`, but that's not possible:

> A volatile field cannot be of the type 'T'.

Since this is a simpler case of code I've already written, which uses `ConcurrentQueue<T>`, I thought about using it here too:

    ConcurrentQueue<T> item;

    public T Item
    {
        get
        {
            T result;
            item.TryPeek(out result);
            return item;
        }

        set
        {
            item.TryEnqueue(value);
            T ignored;
            item.TryDequeue(out ignored);
        }
    }

This would work, but it seems to me that it's overcomplicated solution to something that should be simple.

Performance is important, so, if possible, locking should be avoided.

If a `set` happens at the same time as `get`, I don't care whether `get` returns the old value or the new value.