title: Using List<KeyValuePair> to store Keys and Values
body: <p>I'm still trying to understand <code>KeyValuePairs</code> but I believe this idea should work.  In my code below it searchs through a large string and extracts 2 substrings.  One substring (keep in mind the value between the quotes varies) is something like <code>Identity="EDN\username"</code> another substring is something like <code>FrameworkSiteID="Desoto"</code>  So I was thinking about combining these strings together before I added them to the List but here is my problem.. The <strong>login</strong> string below is a Unique field of strings that I need to use in a SQL statement to select records in SQLServer and the <strong>framew</strong> strings are strings I need lined up with the login strings (and all the columns and rows of data coming from SQLServer) when I output this to a text file.  Should I make the login strings KEYS and the framew strings VALUES?  If so how do I do that??  Hope that makes sense.  I can further explain if needs be</p>
  
  <pre><code>Regex reg = new Regex("Identity=\"[^\"]*\"");
  Regex reg1 = new Regex("FrameworkSiteID=\"[^\"]*\"");
  
  foreach (FileInfo file in Files)
  {
      string line = "";
      using (StreamReader sr = new StreamReader(file.FullName))
      {
          while (!String.IsNullOrEmpty(line = sr.ReadLine()))
          {
              if (line.ToUpper().Contains("IDENTITY="))
              {
                  string login = reg.Match(line).Groups[0].Value;
                  string framew = reg1.Match(line).Groups[0].Value; //added
                  IdentityLines.Add(new KeyValuePair&lt;string, string&gt;(file.Name, login + " " + framew));
                      //This is probably not what I need
              }
  
  
              else
              {
                  IdentityLines.Add(new KeyValuePair&lt;string, string&gt;(file.Name, "NO LOGIN"));
              }
          }
  </code></pre>