コード例 #1
0
        //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]);
            }
        }
コード例 #2
0
 public CSVFile(string path)
 {
     //passing file path into parser
     Parser = new CSVParser(path);
     Data   = new CSVData();
 }
コード例 #3
0
 //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]));
 }