RandomAccess.Write Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Write(SafeFileHandle, IReadOnlyList<ReadOnlyMemory<Byte>>, Int64) |
Writes a sequence of bytes from given buffers to given file at given offset. |
Write(SafeFileHandle, ReadOnlySpan<Byte>, Int64) |
Writes a sequence of bytes from given buffer to given file at given offset. |
- Source:
- RandomAccess.cs
- Source:
- RandomAccess.cs
- Source:
- RandomAccess.cs
Writes a sequence of bytes from given buffers to given file at given offset.
public:
static void Write(Microsoft::Win32::SafeHandles::SafeFileHandle ^ handle, System::Collections::Generic::IReadOnlyList<ReadOnlyMemory<System::Byte>> ^ buffers, long fileOffset);
public static void Write(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<ReadOnlyMemory<byte>> buffers, long fileOffset);
static member Write : Microsoft.Win32.SafeHandles.SafeFileHandle * System.Collections.Generic.IReadOnlyList<ReadOnlyMemory<byte>> * int64 -> unit
Public Shared Sub Write (handle As SafeFileHandle, buffers As IReadOnlyList(Of ReadOnlyMemory(Of Byte)), fileOffset As Long)
Parameters
- handle
- SafeFileHandle
The file handle.
- buffers
- IReadOnlyList<ReadOnlyMemory<Byte>>
A list of memory buffers. This method copies the contents of these buffers to the file.
- fileOffset
- Int64
The file position to write to.
Exceptions
handle
or buffers
is null
.
handle
is invalid.
The file is closed.
The file does not support seeking (pipe or socket).
fileOffset
is negative.
handle
was not opened for writing.
An I/O error occurred.
Remarks
Position of the file is not advanced.
Applies to
.NET 10 and other versions
Product | Versions |
---|---|
.NET | 6, 7, 8, 9, 10 |
- Source:
- RandomAccess.cs
- Source:
- RandomAccess.cs
- Source:
- RandomAccess.cs
Writes a sequence of bytes from given buffer to given file at given offset.
public:
static void Write(Microsoft::Win32::SafeHandles::SafeFileHandle ^ handle, ReadOnlySpan<System::Byte> buffer, long fileOffset);
public static void Write(Microsoft.Win32.SafeHandles.SafeFileHandle handle, ReadOnlySpan<byte> buffer, long fileOffset);
static member Write : Microsoft.Win32.SafeHandles.SafeFileHandle * ReadOnlySpan<byte> * int64 -> unit
Public Shared Sub Write (handle As SafeFileHandle, buffer As ReadOnlySpan(Of Byte), fileOffset As Long)
Parameters
- handle
- SafeFileHandle
The file handle.
- buffer
- ReadOnlySpan<Byte>
A region of memory. This method copies the contents of this region to the file.
- fileOffset
- Int64
The file position to write to.
Exceptions
handle
is null
.
handle
is invalid.
The file is closed.
The file does not support seeking (pipe or socket).
fileOffset
is negative.
handle
was not opened for writing.
An I/O error occurred.
Remarks
Position of the file is not advanced.
Applies to
.NET 10 and other versions
Product | Versions |
---|---|
.NET | 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: