fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. foreach (var b in StringToByteArray("26246026"))
  9. {
  10. Console.WriteLine(b);
  11. }
  12. }
  13.  
  14. public static byte[] StringToByteArray(string hex)
  15. {
  16.  
  17. return Enumerable.Range(0, hex.Length)
  18. .Where(x => x % 2 == 0)
  19. .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
  20. .ToArray();
  21. }
  22. }
Success #stdin #stdout 0.04s 23992KB
stdin
Standard input is empty
stdout
38
36
96
38