title: Using the Dictionary method in C#
body: <p>I am currently using the Dictionary method in C# to index a text file successfully, although in this case I would like to index more than one keyword (#HostName). I have tried adding an additional IF statement to the method although it doesn't appear to work - by that I mean it seems to break the whole method.</p>
  
  <pre><code> var dictionary = new Dictionary&lt;string, string&gt;();
   var lines = File.ReadLines("probe_settings.ini");
   var ee = lines.GetEnumerator();
   while (ee.MoveNext())
   {
       if (ee.Current.StartsWith("#PortNo"))
       {
           string test = ee.Current;
           if (ee.MoveNext())
           {
               dictionary.Add(test, ee.Current);
           }
           else
           {
               throw new Exception("File not in expected format.");
           }
       }
   }
  </code></pre>
  
  <p>Is it possible to index another term in this method? How could it be done?</p>
  
  <p>Below is the file it is reading:</p>
  
  <pre><code>#CheckName1
  HTTP Check
  
  #PortNo1
  80
  
  #CheckName2
  HTTPS Check
  
  #PortNo2
  443
  </code></pre>