File.AppendAllBytes Method

Definition

Overloads

AppendAllBytes(String, Byte[])

Appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file.

AppendAllBytes(String, ReadOnlySpan<Byte>)

Appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file.

AppendAllBytes(String, Byte[])

Source:
File.cs

Appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file.

public:
 static void AppendAllBytes(System::String ^ path, cli::array <System::Byte> ^ bytes);
public static void AppendAllBytes (string path, byte[] bytes);
static member AppendAllBytes : string * byte[] -> unit
Public Shared Sub AppendAllBytes (path As String, bytes As Byte())

Parameters

path
String

The file to append to.

bytes
Byte[]

The bytes to append to the file.

Exceptions

path or bytes is null.

path is empty.

The specified path, file name, or both exceed the system-defined maximum length.

The specified path is invalid (for example, it is on an unmapped drive).

An I/O error occurred while opening the file.

path specified a file that is read-only.

-or-

path specified a file that is hidden.

-or-

path specified a directory.

-or-

The caller does not have the required permission.

-or-

This operation is not supported on the current platform.

path is in an invalid format.

Applies to

AppendAllBytes(String, ReadOnlySpan<Byte>)

Appends the specified byte array to the end of the file at the given path.

If the file doesn't exist, this method creates a new file.

public:
 static void AppendAllBytes(System::String ^ path, ReadOnlySpan<System::Byte> bytes);
public static void AppendAllBytes (string path, ReadOnlySpan<byte> bytes);
static member AppendAllBytes : string * ReadOnlySpan<byte> -> unit
Public Shared Sub AppendAllBytes (path As String, bytes As ReadOnlySpan(Of Byte))

Parameters

path
String

The file to append to.

bytes
ReadOnlySpan<Byte>

The bytes to append to the file.

Exceptions

path is null.

path is empty.

The specified path, file name, or both exceed the system-defined maximum length.

The specified path is invalid (for example, it is on an unmapped drive).

An I/O error occurred while opening the file.

path specified a file that is read-only.

-or-

path specified a file that is hidden.

-or-

path specified a directory.

The caller does not have the required permission.

-or-

This operation is not supported on the current platform.

path is in an invalid format.

Applies to