Categories
How to write everything in a textbox to a byte array?
I write in the text box this is 00 03 01 00 00 0C how to make it write in 2 digits in each index for example k[0]=00 k[1]= 03 and so on
Answer the question
In order to leave comments, you need to log in
var hexText = "7586487389962e"; var binaryText = StringToByteArray(hexText); public static byte[] StringToByteArray(string hex) { return Enumerable.Range(0, hex.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) .ToArray(); }
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question