Share via


ReadAllBytes Method

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

Opens a binary file, reads the contents of the file into a byte array, and then closes the file.

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

Syntax

'Declaration
Public Shared Function ReadAllBytes ( _
    path As String _
) As Byte()
public static byte[] ReadAllBytes(
    string path
)
public:
static array<unsigned char>^ ReadAllBytes(
    String^ path
)
static member ReadAllBytes : 
        path:string -> byte[] 
public static function ReadAllBytes(
    path : String
) : byte[]

Parameters

Return Value

Type: array<System. . :: . .Byte> [] () [] []
A byte array containing the contents of the file.

Remarks

Given a file path, this method opens the file, reads the contents of the file into a byte array, and then closes the file.

.NET Framework Security

See Also

Reference

File Class

System.IO Namespace