title: Is there an equivalent function in C# for Python's binascii.b2a_hex?
body: <p>I'm trying to port some code from a Python server that uses <code>binascii.b2a_hex</code>. I don't know of any C# equivalent. What function in C# would give me the same result?</p>
  
  <p>I've looked up online to see if anyone has had the same question but have yet to find someone. I even looked for thirdparty libraries. I did make my application get the result from a Python script but I wanted to port the code authentically.</p>
  
  <pre><code>def send_withlen(self, data, log = True) :
      lengthstr = struct.pack("&gt;L", len(data))
      if log :
          logging.debug(str(self.address) + ": Sent data with length - " + binascii.b2a_hex(lengthstr) + " " + binascii.b2a_hex(data))
      totaldata = lengthstr + data
      totalsent = 0
      while totalsent &lt; len(totaldata) :
          sent = self.send(totaldata, False)
          if sent == 0:
              raise RuntimeError, "socket connection broken"
          totalsent = totalsent + sent
  </code></pre>
  
  <p>Here is an example of some logger debug lines showing the format of the output from the function:</p>
  
  <pre><code>2019-10-15 00:03:14,220 root         DEBUG    ('192.168.0.17', 59176): Sent data with length - 0000010a 01500a010000000000000400040000000c0000001200000004000400000005000000120000000400040000000000000003000000040004000000060000000e00000004000400000004000000110000000400040000000a000000110000000400040000000b000000626172000400040000000f0000000e0100000400040000000200000057000000040004000000030000000000000004000400000009000000666f6f0004000400000007000000626f6f000400040000000d000000666f6f0004000400000008000000fb0000000400240000000e000000015024000000000000000300040000006361631a00000003000400000063617308000000040004000000010000000e000000
  
  2019-10-15 00:03:14,292 dirsrv       INFO     ('192.168.0.17', 59178): Sending out list of content list servers
  2019-10-15 00:03:14,293 root         DEBUG    ('192.168.0.17', 59178): Sent data with length - 00000008 0001c0a800119d69
  </code></pre>