Here's a nice fun LINQ example.
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(); }
2.1m questions
2.1m answers
60 comments
57.0k users