Beispiel #1
0
 public void SnimiCSV(string datoteka)
 {
     using (TextWriter tw = File.CreateText(datoteka))
     {
         try
         {
             tw.WriteLine(Automobile.CSVZaglavlje());
             foreach (Automobile a in Lista)
             {
                 if (a != null)
                 {
                     string s = a.CSV().Trim();
                     if (s != null && !s.Equals(string.Empty))
                     {
                         tw.WriteLine(s);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             EventLogger.WriteEventError("Greška pri generisanju CSV fajla.", ex);
         }
         finally
         {
             tw.Close();
         }
     }
 }