public void Clear(ref UnmanagedArray <T> target, SerializationContext context) { // nothing to clear since T is a pure value type }
public void Clone(UnmanagedArray <T> instance, ref UnmanagedArray <T> target, SerializationContext context) { Buffer.MemoryCopy((void *)instance.data, (void *)target.data, target.length, instance.Length); }
public void Dispose() { this.array = null; this.position = IntPtr.Zero; this.last = IntPtr.Zero; }
private UnmanagedArray <T> array; // to keep alive public UnmanagedEnumerator(UnmanagedArray <T> array) { this.array = array; this.position = array.data - UnmanagedArray <T> .ElementSize; this.last = array.data + ((array.Length - 1) * UnmanagedArray <T> .ElementSize); }
/// <summary> /// Copies all the elements of the current one-dimensional array to the specified one-dimensional array. /// </summary> /// <param name="destination">The one-dimensional array that is the destination of the elements copied from the current array.</param> /// <param name="index">The index in the destination array at which copying begins.</param> public void CopyTo(UnmanagedArray <T> destination, int index) { this.CopyTo(destination, 0, 0, this.length); }
/// <summary> /// Copies all the elements of the current one-dimensional array to the specified one-dimensional array. /// </summary> /// <param name="destination">The one-dimensional array that is the destination of the elements copied from the current array.</param> public void CopyTo(UnmanagedArray <T> destination) { this.CopyTo(destination, 0); }