Export (0) Print
Expand All

BitConverter.ToString Method (Byte[])

Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string representation.

Namespace:  System
Assemblies:   System.Runtime.Extensions (in System.Runtime.Extensions.dll)
  mscorlib (in mscorlib.dll)

static member ToString : 
        value:byte[] -> string


Type: System.Byte[]

An array of bytes.

Return Value

Type: System.String
A string of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A-00".


value is a null reference (Nothing in Visual Basic).

All the elements of value are converted. The order of hexadecimal strings returned by the ToString method depends on whether the computer architecture is little-endian or big-endian.

The following code example converts Byte arrays to String objects with the ToString method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
© 2015 Microsoft