HexToByteArray
Converts a hexadecimal string to a byte array.
- Use
Enumerable.Range()in combination withstring.Lengthto get the indices of the given string in an array. - Use
Enumerable.Where()to get only the even indices in the previous range. - Use
Enumerable.Select()in combination withConvert.ToByte()andstring.Substring()to convert each byte's hex code to abyte. - Finally, use
Enumerable.ToArray()to return abyte[].