Share via


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

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

See Also

Reference

File Class

System.IO Namespace