CryptoSys PKI Pro Manual

HexExtension.FromHex Method

Decode a hex-encoded string

Syntax

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

Parameters

s  String
Input string of hex characters

Return Value

Byte
Decoded byte array

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. 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 = "00010203".FromHex();
// { 0x00, 0x01, 0x02, 0x03 };

[Contents] [Index]

[PREV: Hash.Length Method...]   [Contents]   [Index]   
   [NEXT: HexExtension.ToHex Method...]

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