title: convert string of hex to string of little endian in c#
body: <p>I have a string representation of an hex number and I want to get a string representation of the little endian.</p>
  
  <p>for example the input is: "112C4F"</p>
  
  <p>the output should be: "4F2C11"</p>
  
  <p>I'm using c# for it.</p>
  
  <p>eventually I came up with this: </p>
  
  <pre><code>string text = "3A221C"; 
  int tmp = int.Parse(text, NumberStyles.HexNumber); 
  var reversedBytes = System.Net.IPAddress.NetworkToHostOrder(tmp); 
  var hex = reversedBytes.ToString("x"); 
  var trimmed = hex.Substring(0, text.Length); 
  Console.WriteLine(trimmed);
  </code></pre>
  
  <p>the output was "1c223a"</p>
  
  <p>since I don't really know what the third line is doing I'm not sure it will always work as I expect it to work. also I don't know why I had extra zeros that I had to trim?</p>