title: how to keep appending the list of values of a column until we get a new value in another column?
body: <p>I am trying to keep appending a list of values to lookaheadRunInfo.gerrits until I get a new lookaheadRunInfo.ECJobLink in the while loop,I tried to create a variable “ECJoblink_previous” to capture the previous ECJoblink and create a new list only when they are different and keep appending until ECJoblink_previous changes,I tried as below but its not working,what am I missing?</p>
  
  <pre><code>try
  {
      Console.WriteLine("Connecting to MySQL...");
      conn.Open();
  
      string sql = @"some query";
      var ECJoblink_previous ="";    
      MySqlCommand cmd = new MySqlCommand(sql, conn);
      MySqlDataReader rdr = cmd.ExecuteReader();
  
      while (rdr.Read())
      {
          //Console.WriteLine(rdr[0] + " -- " + rdr[1]);
          //Console.ReadLine();
          lookaheadRunInfo.ECJobLink = rdr.GetString(0);
          if (ECJoblink_previous == lookaheadRunInfo.ECJobLink)
          {
              //Keep appending the list of gerrits until we get a new lookaheadRunInfo.ECJobLink
              var gerritList = new List&lt;String&gt;();
              lookaheadRunInfo.gerrits = gerritList.Add(rdr.GetString(2));
          }
          ECJoblink_previous = lookaheadRunInfo.ECJobLink;
          lookaheadRunInfo.UserSubmitted = rdr.GetString(2);
          lookaheadRunInfo.SubmittedTime = rdr.GetString(3).ToString();
          lookaheadRunInfo.RunStatus = "null";
          lookaheadRunInfo.ElapsedTime = (DateTime.UtcNow - rdr.GetDateTime(3)).ToString();
          lookaheadRunsInfo.Add(lookaheadRunInfo);
      }
  
      rdr.Close();
  }
  </code></pre>