-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSVFileReaderManager.cs
More file actions
32 lines (27 loc) · 897 Bytes
/
Copy pathCSVFileReaderManager.cs
File metadata and controls
32 lines (27 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Common.Module.Interface;
using FileReader.Module.Interface;
using LumenWorks.Framework.IO.Csv;
using System.Collections.Generic;
using System.Data.OleDb;
using System.IO;
namespace FileReader.Module.Provider
{
public class CSVFileReaderManager<T> : IFileReader<T>
{
const string fileExt = ".csv";
public IList<T> ReadFileContent(string pathLocation, IFileReaderDataManager<T> converter)
{
return this.ReadCSVFile(pathLocation + fileExt, converter);
}
private IList<T> ReadCSVFile(string pathLocation, IFileReaderDataManager<T> converter)
{
IList<T> dataList;
using (CsvReader csv =
new CsvReader(new StreamReader(pathLocation), true))
{
dataList = converter.GenerateData(csv);
}
return dataList;
}
}
}