I am practicing HexadecimalStringToByteArray() on VS2017. But throw exception. Could you please tell me more information about it?
Exception alert **An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Could not find any recognizable digits.**
public static byte[] HexadecimalStringToByteArray(string input) { var outputLength = input.Length / 2; var output = new byte[outputLength]; using (var sr = new StringReader(input)) { for (var i = 0; i < outputLength; i++) output[i] = Convert.ToByte(new string(new char[2] { (char)sr.Read(), (char)sr.Read() }), 16); } return output; }
Attachment: InsuranceDataTransfer2.rar