Пример #1
0
            internal static void SwapContents(Owned a, Owned b)
            {
                a.EnsureNotDisposed();
                b.EnsureNotDisposed();

                IMemoryOwner <T>[] tempOwners = a.memoryOwners;
                long tempTotalLength          = a.TotalLength;
                int  tempBufferLength         = a.BufferLength;

                a.memoryOwners = b.memoryOwners;
                a.TotalLength  = b.TotalLength;
                a.BufferLength = b.BufferLength;

                b.memoryOwners = tempOwners;
                b.TotalLength  = tempTotalLength;
                b.BufferLength = tempBufferLength;

                a.View.Invalidate();
                b.View.Invalidate();
                a.View = new MemoryGroupView <T>(a);
                b.View = new MemoryGroupView <T>(b);
            }