CSharp examples for System:Byte
Hex To Byte Array
using System.Text.RegularExpressions; using System.Text; using System.Linq; using System.Globalization; using System;//ww w . ja va 2 s . co m public class Main{ public static byte[] HexToByteArray(this string input) { return Enumerable.Range(0, input.Length) .Where(x => x%2 == 0) .Select(x => Convert.ToByte(input.Substring(x, 2), 16)) .ToArray(); } }