BitConverter.ToString Method (Byte[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

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

Parameters

value
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".

Exception Condition
ArgumentNullException

value is null.

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.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: