title: Convert hex-encoded string to unicode text
body: <p>I have strings like "74657374696e67" (that is "testing"), hex encoded unicode text. Need to convert it back to readable output. 
  How to do this in .NET?</p>
  
  <p>Update:</p>
  
  <p>The text was originally encoded using the following Visual Basic 6 function:</p>
  
  <pre><code>Public Function EnHex(Data As String) As String
      Dim iCount As Double, sTemp As String
      Reset
      For iCount = 1 To Len(Data)
          sTemp = Hex$(Asc(Mid$(Data, iCount, 1)))
          If Len(sTemp) &lt; 2 Then sTemp = "0" &amp; sTemp
          Append sTemp
      Next
      EnHex = GData
      Reset
  End Function
  </code></pre>
  
  <p>The decoding was done as follows:</p>
  
  <pre><code>Public Function DeHex(Data As String) As String
      Dim iCount As Double
      Reset
      For iCount = 1 To Len(Data) Step 2
          Append Chr$(Val("&amp;H" &amp; Mid$(Data, iCount, 2)))
      Next
      DeHex = GData
      Reset
  End Function
  </code></pre>