title: Export C# List to Csv file
body: <p>I was trying to export my C# list to Csv file. All is set well. But the thing is field seperator is not working properly. its showing like, my string with " at the end (eg: 0000324df"). Here is my Controller code.</p>
  
  <pre><code>IEnumerable stockexpo = stockexp; // Assign value
          MemoryStream output = new MemoryStream();
          StreamWriter writer = new StreamWriter(output, Encoding.UTF8);
          writer.Write("ItemNo,");
          writer.Write("Repeat Count");
          writer.WriteLine();
          foreach (StockResult order in stockexpo)
          {
              writer.Write(String.Format("{0:d}", order.ItemNumber));
              writer.Write("\"");
              writer.Write(",");
              writer.Write("\"");
              writer.Write(order.Count);
              writer.Write("\"");
              writer.Write(",");
              writer.WriteLine();
          }
          writer.Flush();
          output.Position = 0;
  
          return File(output, "text/comma-separated-values", "stockexp.csv");
  </code></pre>
  
  <p>I need to know how i can seperate the field values appropriately. Anyone can help me for this.</p>