CryptoSys PKI Pro Manual

HexExtension.ToHex Method

Encode a byte array in hexadecimal

Syntax

[C#]
public static string ToHex(
   this byte[] b 
)
[VB]
<ExtensionAttribute> Public Shared Function ToHex (
   b As Byte() 
) As String

Parameters

b  Byte
Input byte array

Return Value

String
Hex-encoded string

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Byte. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Example

byte[] b = { 0x00, 0x01, 0x02, 0x03 };
string s = b.ToHex();  // 00010203

[Contents] [Index]

[PREV: HexExtension.FromHex Method...]   [Contents]   [Index]   
   [NEXT: Hmac.BytesFromBytes Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.