Export (0) Print
Expand All

BitConverter.ToString Method (Byte[], Int32)

Converts the numeric value of each element of a specified subarray 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[] * 
        startIndex:int -> string


Type: System.Byte[]

An array of bytes.

Type: System.Int32

The starting position within value.

Return Value

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


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


startIndex is less than zero or greater than the length of value minus 1.

The elements from array position startIndex to the end of the array 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 the part of a Byte array starting at the specified startIndex to a String 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