//Parses the CSV and adds the data into the CSVData object that is passed in public void Parse(CSVData data) { Parser.SetDelimiters(new string[] { "," }); //Setting Fields in CSVData object data.Fields = Parser.ReadFields().ToList(); int index = 0; while (!Parser.EndOfData) { //adding each entry into the CSVData object and validating emails string[] line = Parser.ReadFields(); List <string> entry = line.ToList(); data.AddEntry(entry); EmailValidator.ValidateEmail(data, index++, entry[2]); } }
public CSVFile(string path) { //passing file path into parser Parser = new CSVParser(path); Data = new CSVData(); }
//Print a column filtered by a given list of indices public static void PrintColumnByIndices(CSVData data, int column, List <int> indices) { indices.ForEach(index => Console.WriteLine(data.Entries[index][column])); }