title: Inserting data to .CSV file at the same time using foreach
body: <p>I am new here and actually very new to c#. 
  In a nutshell, I am using c# via Visual Studio, I am calling a data from a database and I want to save these data in a .csv file. The problem now is that I want to save these data on two columns at the same time. </p>
  
  <p>My code do write them in a file but shifted not on the right rows.</p>
  
  <pre><code>        Dictionary&lt;string, string&gt; elementNames = new Dictionary&lt;string, string&gt;();
          Dictionary&lt;string, string&gt; elementTypes = new Dictionary&lt;string, string&gt;();
          var nodes = webservice.nepService.GetAllElementsOfElementType(webservice.ext, "Busbar", ref elementNames, ref elementTypes);
          Dictionary&lt;string, string&gt; nodeResults = new Dictionary&lt;string, string&gt;();
          Dictionary&lt;string, string&gt; nodeResults1 = new Dictionary&lt;string, string&gt;();
          foreach (var nodename in elementNames.Values)
          {
              var nodeRes = webservice.nepService.GetResultElementByName(webservice.ext, nodename, "Busbar", -1, "LoadFlow", null);
              var Uvolt = GetXMLAttribute(nodeRes, "U");                
              nodeResults.Add(nodename, Uvolt);                          
              var Upercentage = GetXMLAttribute(nodeRes, "Up");
              nodeResults1.Add(nodename, Upercentage);
      StringBuilder strBldr = new StringBuilder();
              string outputFile = @"C:\Users\12.csv";
              string separator = ",";   
  
              foreach (var res in nodeResults)
              {
                  strBldr.AppendLine($"{res.Key}{separator}{res.Value}");
              }
  
              foreach (var res1 in nodeResults1)
              {
  
                  strBldr.AppendLine($"{separator}{separator}{res1.Value}");
              }
  
              File.WriteAllText(outputFile, strBldr.ToString());
          }
  </code></pre>
  
  <p>this is the output of the previous code:
  <a href="https://ibb.co/T4trQC3" rel="nofollow noreferrer">https://ibb.co/T4trQC3</a></p>
  
  <p>I want these shifted values to move up beside the other values like that: 
  <a href="https://ibb.co/4S25v0h" rel="nofollow noreferrer">https://ibb.co/4S25v0h</a>
  Thank you</p>