title: search string and and convert to byte c#
body: <p>I want to get specific string from txt file and after that convert the string to byte for example I have this txt file:</p>
  
  <p>; "one"</p>
  
  <p>id_number:*=344E6F4D6F7265486178785454332100</p>
  
  <p>; "two"</p>
  
  <p>id_number:*=3536336A775E3825246E773543563437</p>
  
  <p>; "three"</p>
  
  <p>id:_number*=BDBD2EB72D82473DBE09F1B552A8983</p>
  
  <p>Now what I want is to search the title and after that gets the id_number of the title and after that convert it to a byte like that this for title:</p>
  
  <p>TWO (
   byte[] two = new byte[] { 0xBD, 0xBD, 0x2E, 0xB7, 0x2D, 0x82, 0x47, 0x3D, 0xBE, 0x09, 0xF1, 0x1B, 0x55, 0x2A, 0x89, 0x83 };</p>
  
  <p>i try this but dosen't work : </p>
  
  <pre><code>    string[] s = File.ReadAllLines("MyFilePath.txt");
  List&lt;byte[]&gt; byteArrays = new List&lt;byte[]&gt;();
  foreach (string st in s.Where(x =&gt; x.Trim().StartsWith("id_number:*=")).Select(x =&gt; x.Skip(12)))
  {
      byte[] b = new byte[(int)((st.Length + 1) / 2)];
      for (int i = 0; i &lt; (int)((st.Length + 1) / 2); i++)
      {
          var byteString = (st.Skip(2 * i).Length &gt; 2) ?  st.Skip(2 * i).Take(2) : "0"+st.Skip(2 * i);
          var bt = Convert.ToByte(byteString, 16);
          b[i] = bt;
      }
      byteArrays.Add(b);
  }
  </code></pre>
  
  <p>and i dont now where i can put the title ? </p>
  
  <p>please help</p>