using System; using System.Linq; public class Test { public static void Main() { foreach (var b in StringToByteArray("26246026")) { Console.WriteLine(b); } } 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(); } }