public static int USCensusRecords(string uscensus) { try { bool type = CSVOperations.CheckFileType(uscensus, ".csv"); string[] records = CSVOperations.ReadCSVFile(uscensus); int count = CSVOperations.CountRecords(records); return(count); } catch (Exception) { throw; } }
/// <summary> ///Method to find Number of records in file for StateCode csv file /// </summary> public static int getDataFromCSVFile(string statecode, char delimiter = ',', string header = "SrNo,State,TIN,StateCode") { try { bool type = CSVOperations.CheckFileType(statecode, ".csv"); string[] records = CSVOperations.ReadCSVFile(statecode); bool delimit = CSVOperations.CheckForDelimiter(records, delimiter); bool head = CSVOperations.CheckForHeader(records, header); int count = CSVOperations.CountRecords(records); return(count); } catch (Exception) { throw; } }
public static int NumberOfRecords(string filepath, char delimiter = ',', string header = "State,Population,AreaInSqKm,DensityPerSqKm") { try { bool type = CSVOperations.CheckFileType(filepath, ".csv"); string[] records = CSVOperations.ReadCSVFile(filepath); bool del = CSVOperations.CheckForDelimiter(records, delimiter); bool head = CSVOperations.CheckForHeader(records, header); int count = CSVOperations.CountRecords(records); return(count); } catch (Exception) { throw; } }