WriteAllBytes Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

public static void WriteAllBytes(
	string path,
	byte[] bytes
)

Parameters

path
Type: System..::..String
The file to write to.
bytes
Type: array<System..::..Byte>[]()[][]
The bytes to write to the file.

Given a byte array and a file path, this method opens the specified file, writes the contents of the byte array to the file, and then closes the file.

Show: