protected override unsafe void UseBufferPointerImpl(UseBufferPointerDelegate action) { fixed(byte *ptr = this.buffer) { action(ptr, this.Length); } }
public unsafe void UseBufferPointer(UseBufferPointerDelegate action) { if (action is null) { ExceptionUtil.ThrowArgumentNullException(nameof(action)); } VerifyNotDisposed(); UseBufferPointerImpl(action); }
protected override unsafe void UseBufferPointerImpl(UseBufferPointerDelegate action) { byte *ptr = null; RuntimeHelpers.PrepareDelegate(action); RuntimeHelpers.PrepareConstrainedRegions(); try { this.buffer.AcquirePointer(ref ptr); action(ptr, this.Length); } finally { if (ptr != null) { this.buffer.ReleasePointer(); } } }
protected abstract unsafe void UseBufferPointerImpl(UseBufferPointerDelegate action);