Encoding.GetString Method (Byte)
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Overridable Function GetString ( _ bytes As Byte() _ ) As String 'Usage Dim instance As Encoding Dim bytes As Byte() Dim returnValue As String returnValue = instance.GetString(bytes)
The byte array containing the sequence of bytes to decode.
Return ValueA String containing the results of decoding the specified sequence of bytes.
bytes is a null reference (Nothing in Visual Basic).
If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.
The following code example demonstrates how to read a UTF-8 encoded string from a binary file.
Private Function ReadAuthor(binary_file As Stream) As String Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8 ' Read string from binary file with UTF8 encoding Dim buffer(30) As Byte binary_file.Read(buffer, 0, 30) Return encoding.GetString(buffer) End Function
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.