Cette question est similaire à la one here.BuiltIn fonction de convertir de chaîne hexadécimale à octet
On peut facilement convertir chaîne hexadécimale à octet par la formule suivante:
public static byte[] HexStringToBytes(string hex)
{
byte[] data = new byte[hex.Length /2];
int j = 0;
for (int i = 0; i < hex.Length; i+=2)
{
data[ j ] = Convert.ToByte(hex.Substring(i, 2), 16);
++j;
}
return data;
}
Mais est-il une fonction intégrée (intérieur NET Framework) pour cela?
Il convertit seulement 'byte', pas un tableau de' bytes' – Graviton