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)
Syntax
'Declaration
Public Shared Sub WriteAllBytes ( _
path As String, _
bytes As Byte() _
)
public static void WriteAllBytes(
string path,
byte[] bytes
)
public:
static void WriteAllBytes(
String^ path,
array<unsigned char>^ bytes
)
static member WriteAllBytes :
path:string *
bytes:byte[] -> unit
public static function WriteAllBytes(
path : String,
bytes : byte[]
)
Parameters
- path
Type: System. . :: . .String
The file to write to.
- bytes
Type: array<System. . :: . .Byte> [] () [] []
The bytes to write to the file.
Remarks
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.