/// <inheritdoc /> public override MemoryHandle Pin(int elementIndex = 0) { DebugGuard.NotDisposed(this.disposed == 1, this.GetType().Name); DebugGuard.NotDisposed(this.lifetimeGuard.IsDisposed, this.lifetimeGuard.GetType().Name); // Will be released in Unpin this.lifetimeGuard.AddRef(); void *pbData = Unsafe.Add <T>(this.Pointer, elementIndex); return(new MemoryHandle(pbData, pinnable: this)); }
public override Span <T> GetSpan() { DebugGuard.NotDisposed(this.disposed == 1, this.GetType().Name); DebugGuard.NotDisposed(this.lifetimeGuard.IsDisposed, this.lifetimeGuard.GetType().Name); return(new(this.Pointer, this.lengthInElements)); }