title: Adding List Data to a Text File
body: <p>I am trying to save the list of data from C# code to a text file. It throws an error at <code>foreach</code> stating that list cannot be converted to string. Any ideas where I am going wrong?</p>
  
  <p>I have to Run Application only on .Net Framework 3.5</p>
  
  <pre><code>IList&lt;FolderDetails&gt; ListToCheck;
  
   using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\LogFile.txt"))
   {
       foreach (string line in ListToCheck)
       {                       
           file.WriteLine(line);                        
       }
  }
  public class FolderDetails
  {
      public string PropertyGroupName { get; set; }
      public string ProjFiles { get; set; }
  }
  </code></pre>