public void CopyToTest() { var q = UnsafeRingBuffer.Allocate <int>(10); SplitRingBuffer(q); var arr = new int[10]; fixed(void *ptr = arr) { UnsafeRingBuffer.CopyTo <int>(q, ptr, 0); } for (int i = 0; i < 10; i++) { Assert.AreEqual(i, arr[i]); } }
public void CopyTo(T[] array, int arrayIndex) { if (array == null) { throw new ArgumentNullException(nameof(array)); } if ((uint)arrayIndex > array.Length) { throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } if (array.Length - arrayIndex < Count) { throw new ArgumentException("Insufficient space in the target location to copy the information."); } if (array.Length == 0) { return; fixed(void *ptr = array) UnsafeRingBuffer.CopyTo <T>(m_inner, ptr, arrayIndex); }