title: Creating dictionary from text file and then accessing it
body: <p>I'm building a program.
  It uses data stored in text files in following format {Index:Value}. Example:</p>
  
  <pre><code>1:10,86;
  2:11,65;
  3:13,32;
  4:13,53;
  5:13,93;
  ...
  1500:1565,99;
  </code></pre>
  
  <p>There is rougly 1490-1500 lines in each file.</p>
  
  <p>I need those files read in a dictionary and access its Index as integer and Value as double both by different functions. Something like:</p>
  
  <pre><code>Data.ByIndex((integer) 3) - returns (double) 13,32
  </code></pre>
  
  <p>Now getting Index by Value would be little more tricky:</p>
  
  <pre><code>Data.ByClosestValue((double) 12,0) - returns (integer) 2
  Data.ByClosestValue((double) 13) - returns (integer) 3
  Data.ByClosestLower((double) 13,5) - returns (integer) 3
  Data.ByClosestHigher((double) 13,5) - returns (integer) 5
  </code></pre>
  
  <p>There are few key moments:</p>
  
  <ol>
  <li>It has to be really fast. There is usually 10-15 data files read in the same time and the dictionary accessed several times for each file.</li>
  <li>No LINQ if possible.</li>
  </ol>
  
  <p>For now I went with following:</p>
  
  <ol>
  <li>File.ReadAllText() method seems the fastest to me.</li>
  <li>Getting entries by using Split(';') and the Split(':').</li>
  <li><code>Dictionary &lt;string, string&gt;</code>. The reason I went with string types is that if will be faster to read from text data by using Split() function.</li>
  </ol>
  
  <p>What will be the optimal solution?</p>
  
  <p><strong>Update</strong>: most people would suggest storing data in a database and I agree that would be the best solution, but unfortunately I have no control over those data files. These data files are formed in another program and there is a strict requirement it must be editable by human via notepad or whatever.</p>