1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using static wpf_data.models.Globals;
- using System.Threading.Tasks;
- using System.Collections.Generic;
- using wpf_data;
- using CsvHelper;
- using System.Diagnostics;
- using wpf_data.models;
- using static wpf_data.MainWindow;
- using System.IO;
- using System.Globalization;
- namespace wpf_data.models
- {
- public class CSVDataProvider : LocalDataProvider,IDataProvider
- {
- private List<People> PeopleList;
- // конструктор класса
- public CSVDataProvider()
- {
- using (var reader = new StreamReader("./data.csv"))
- {
- using (var csv = new CsvReader(
- reader,
- CultureInfo.InvariantCulture))
- {
- PeopleList = csv.GetRecords<People>().ToList();
- }
- }
- }
- public IEnumerable<People> getPeople()
- {
- return PeopleList;
- }
- }
- }
|