WriteRow() public method

Writes a row of columns to the current CSV file.
public WriteRow ( List columns ) : void
columns List The list of columns to write
return void
Esempio n. 1
0
        public static bool TestWithRow(string inputFile, string outputFile)
        {
            using (var sr = new StreamReader (inputFile, Encoding.GetEncoding ("gbk"))) {
                var reader = new CsvFileReader (sr);
                using( var sw = new StreamWriter (outputFile, false, Encoding.GetEncoding ("gbk")) ) {
                    var writer = new CsvFileWriter(sw);

                    Console.WriteLine ("------------------------------------------------------------------------------");
                    var row = new List<string> ();
                    while (reader.ReadRow(row)) {
                        PrintRow(row);
                        writer.WriteRow( row );
                    }
                    Console.WriteLine ("------------------------------------------------------------------------------");
                }
            }

            return CompareFile (inputFile, outputFile);
        }
 public static void WriteAll(List<List<string>> dataGrid, string path, Encoding encoding)
 {
     using (var sw = new StreamWriter(path, false, encoding)) {
         var cfw = new CsvFileWriter(sw);
         foreach(var row in dataGrid) {
             cfw.WriteRow(row);
         }
     }
 }