title: Decode hex-string to a string in C# like this php code
body: <pre><code>// This function converts from a hexadecimal representation to a string representation.
  function hextostr($hex) {
    $string = "";
    foreach (explode("\n", trim(chunk_split($hex, 2))) as $h) {
      $string .= chr(hexdec($h));
    }
  
   return $string;
   }
  </code></pre>
  
  <p>How would I do the exact same thing in c#?</p>
  
  <p>It is for a payment provider, that only provides sample code in php.</p>