You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using CSVFile;using System;using System.Collections.Generic;using System.IO;using System.Linq;namespaceCSVFileLoader{internalclassProgram{staticvoidMain(string[]args){varfilename=@"Custom.csv";FileInfof=new FileInfo(filename);
Console.WriteLine($"File size = {f.Length}");CSVSettingssettings=new CSVSettings
{LineSeparator="\n",FieldDelimiter='\t',//BufferSize = (int)f.Length};varcsv= CSVReader.FromFile(filename, settings);varoutlines= csv.Lines();varlines= outlines.ToList();
Console.WriteLine($"Real number of lines = {lines.Count}");// Count amount fields by linevarfieldCountDictionary=newDictionary<int,int>();foreach(var line in lines){intfieldCount= line.Length;// Amount of fieldsif(fieldCountDictionary.ContainsKey(fieldCount)){
fieldCountDictionary[fieldCount]++;}else{
fieldCountDictionary[fieldCount]=1;}}// Show number of rows by number of fieldsforeach(var kvp in fieldCountDictionary){
Console.WriteLine($"There are {kvp.Value} rows with {kvp.Key} fields");}}}}
The text was updated successfully, but these errors were encountered:
For information, issue happens while reading line 1474 of Custom.csv file
Record uses 3 lines, but I don't think it's the reason why, because setting BufferSize to file Length bypass the issue.
Custom.csv
The following code enters in an infinite loop on line
Custom.csv file has been added.
Uncomment line with BufferSize makes the code run perfectly.
Loop has been detected so far at CSVFile Line 58
The text was updated successfully, but these errors were encountered: