Share via


How to: Convert an Array of Bytes into a String in Visual BasicĀ 

This topic shows how to convert the bytes from a byte array into a string.

Example

This example uses the GetString method of the System.Text.Encoding.Unicode encoding class to convert all the bytes from a byte array into a string.

Private Function UnicodeBytesToString( _
    ByVal bytes() As Byte) _
    As String

    Return System.Text.Encoding.Unicode.GetString(bytes)
End Function

You can choose from several encoding options to convert a byte array into a string:

See Also

Tasks

How to: Convert Strings into an Array of Bytes in Visual Basic

Reference

System.Text.Encoding
GetString