Я прочитал ответы здесь qaru.site/info/22148/...
Я также пытался создать эквивалентный код VB.net:
Option Strict ON
Public Function ParseHex(hexString As String) As Byte()
    If (hexString.Length And 1) <> 0 Then
        Throw New ArgumentException("Input must have even number of characters")
    End If
    Dim length As Integer = hexString.Length \ 2
    Dim ret(length - 1) As Byte
    Dim i As Integer = 0
    Dim j As Integer = 0
    Do While i < length
        Dim high As Integer = ParseNybble(hexString.Chars(j))
        j += 1
        Dim low As Integer = ParseNybble(hexString.Chars(j))
        j += 1
        ret(i) = CByte((high << 4) Or low)
        i += 1
    Loop
    Return ret
End Function
Private Function ParseNybble(c As Char) As Integer
    If c >= "0"C AndAlso c <= "9"C Then
        Return c - "0"C
    End If
    c = ChrW(c And Not &H20)
    If c >= "A"C AndAlso c <= "F"C Then
        Return c - ("A"C - 10)
    End If
    Throw New ArgumentException("Invalid nybble: " & c)
End Function
Можем ли мы удалить ошибки компиляции в ParseNybble без внедрения преобразований данных?
 Return c - "0"c Оператор '-' не определен для типов 'Char' и 'Char'
 c = ChrW(c And Not &H20) Оператор "И" не определен для типов "Char" и "Integer" 
