System.IO.FileStream.WriteNative C# (CSharp) Method

WriteNative() private method

Unbuffered, writes a block of bytes to the file stream.
private WriteNative ( byte array, int offset, int count ) : void
array byte The buffer containing data to write to the stream.
offset int The zero-based byte offset in array from which to begin copying bytes to the stream.
count int The maximum number of bytes to write.
return void
        private unsafe void WriteNative(byte[] array, int offset, int count)
        {
            VerifyOSHandlePosition();

            fixed (byte* bufPtr = array)
            {
                while (count > 0)
                {
                    int bytesWritten = CheckFileCall(Interop.Sys.Write(_fileHandle, bufPtr + offset, count));
                    Debug.Assert(bytesWritten <= count);

                    _filePosition += bytesWritten;
                    count -= bytesWritten;
                    offset += bytesWritten;
                }
            }
        }