Hi!
I have a function i VB.net which converts a string into the ascii hex version of the characters.
This functions looks like this in vb.net.
Code Snippet
Public Function StrToHex(ByVal str As String) As String
Dim stringPos As Integer Dim strTemp As String Dim strTemp2 As String Dim strAnswer As String = String.EmptystringPos = 1
Do While stringPos <= str.LengthstrTemp = Mid$(str, stringPos, 1)
strTemp2 =
CStr(Hex(Asc(strTemp))) If Len(strTemp2) = 1 ThenstrAnswer = strAnswer &
"0" & strTemp2 ElsestrAnswer = strAnswer & strTemp2
End IfstringPos = stringPos + 1
LoopStrToHex = strAnswer
End Function
So if send the string "3310 A" I get the result "333331302041" back.
My question is how do I accomplish this in C#
Many thanks in advance!