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
Assembly:  mscorlib (in mscorlib.dll)

static member ToString : 
        value:byte[] *
        startIndex:int -> string

Parameters

value
Type: System.Byte[]

An array of bytes.

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

Exception Condition
ArgumentNullException

value is null.

ArgumentOutOfRangeException

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.

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: