/// <summary> /// /// </summary> public static UnmanagedMemoryAccessor CreateAccessor(this IDirectBuffer fixedBuffer, long offset = 0, long length = 0, bool readOnly = false) { if (offset < 0) { throw new ArgumentOutOfRangeException(nameof(offset)); } if (length < 0) { throw new ArgumentOutOfRangeException(nameof(length)); } if (length + offset > fixedBuffer.Length) { throw new ArgumentException("Length plus offset exceed capacity"); } if (length == 0) { length = fixedBuffer.Length - offset; } return(new SafeBufferAccessor(fixedBuffer.CreateSafeBuffer(), offset, length, readOnly)); }