コード例 #1
0
ファイル: CsvImporter.cs プロジェクト: lishxi/_SharpMap
 public DataTable SplitToTable(string path, CsvSettings csvSettings)
 {
     using (var streamReader = new StreamReader(path))
     {
         return SplitToTable(streamReader, csvSettings);
     }
 }
コード例 #2
0
 public DataTable SplitToTable(string path, CsvSettings csvSettings)
 {
     using (var streamReader = new StreamReader(path))
     {
         return(SplitToTable(streamReader, csvSettings));
     }
 }
コード例 #3
0
ファイル: CsvImporter.cs プロジェクト: lishxi/_SharpMap
 public DataTable SplitToTable(StreamReader streamReader, CsvSettings csvSettings)
 {
     var dataTable = new DataTable();
     using (var csvReader = new CsvReader(streamReader, csvSettings.FirstRowIsHeader, csvSettings.Delimiter))
     {
         csvReader.SkipEmptyLines = csvSettings.SkipEmptyLines;
         try
         {
             dataTable.Load(csvReader);
         }
         catch
         {
             //any error result in an empty data table 
             dataTable = new DataTable();
         }
     }
     return dataTable;
 }
コード例 #4
0
        public DataTable SplitToTable(StreamReader streamReader, CsvSettings csvSettings)
        {
            var dataTable = new DataTable();

            using (var csvReader = new CsvReader(streamReader, csvSettings.FirstRowIsHeader, csvSettings.Delimiter))
            {
                csvReader.SkipEmptyLines = csvSettings.SkipEmptyLines;
                try
                {
                    dataTable.Load(csvReader);
                }
                catch
                {
                    //any error result in an empty data table
                    dataTable = new DataTable();
                }
            }
            return(dataTable);
        }