I wrote a small generic implementation of a simple generic double buffer pattern, and I was wondering if it's actually thread safe or can be improved in any way.Note: The specific part that I'm worrying about thread safety is the Swap() function./// <summary>///     Simple generic double buffer implementation class/// </summary>public class DoubleBuffer<T> where T : class{    private T _current;    public DoubleBuffer(T current, T next)    {        _current = current;        Next = next;    }    /// <summary>    ///     Next buffer waiting in line (no active usage should be here)    /// </summary>    public T Next { get; private set; }    /// <summary>    ///     Currently active buffer (active usage should be here)    /// </summary>    public T Current    {        get { return _current; }    }    /// <summary>    ///     Swaps between the buffers    /// </summary>    /// <returns>Returns the buffer previously used before the swap</returns>    public T Swap()    {        var swappedBuffer = _current;        Interlocked.Exchange(ref _current, Next);        Next = swappedBuffer;        return swappedBuffer;    }}
Simple generic double buffer pattern
c#;multithreading;thread safety;generics