title: Hex increment / loop till FFF
body: <p>I have an string which contains a hexadezimal number and i want to increment that hex number until i reach my max number (FFF). How can i loop through so i can get every number between my start hex and FFF?</p>
  
  <p>I tried to convert the string in a byte array but got stuck after that.</p>
  
  <pre><code>string stringHex = "7A";
  string binaryval = "";
  binaryval = Convert.ToString(Convert.ToInt32(stringHex, 16), 2);
  int numOfBytes = binaryval.Length / 8;
  byte[] bytes = new byte[numOfBytes];
  
  for (int i = 0; i &lt; numOfBytes; ++i)
  {
      bytes[i] = Convert.ToByte(binaryval.Substring(8 * i, 8), 2);
  }
  </code></pre>
  
  <p>I need this to create a table which displays all those numbers.</p>
  
  <p>Solution:</p>
  
  <pre><code>        string sHex = Convert.ToString(sIPv4.Split(':')[2]);
  
          for( int intFromHex = int.Parse(sHex, System.Globalization.NumberStyles.HexNumber);intFromHex &lt;= 4095; intFromHex++)//4095 - FFF
          {
              string hexValue = intFromHex.ToString("X");
              //SQL INSERT
          }
  </code></pre>