The IntValue1 in the csv file is a number without double quotes but when the system reads the row it adds double quotes at the beginning and also double quotes followed by semicolon at the end of the row to delimit the row. Because of this, the IntValue1 starts with a double quotes and the system doesn't recognize it as an int... Please help me to fix this error.
The model:
[DelimitedRecord(",")]
public class MyObject
{
private int _ID;
public int ID
{
get { return _ID; }
set { _ID = value; }
}
private DateTime _EventDate;
public DateTime EventDate
{
get { return _EventDate; }
set { _EventDate = value; }
}
private string _IPAddress;
public string IPAddress
{
get { return _IPAddress; }
set { _IPAddress = value; }
}
}
The code for reading & displaying the data:
private static void GetCsvData()
{
var engine = new FileHelperEngine<MyTypeObj>();
//The error occurs at this line:
var result = engine.ReadFile("C:\\CsvFileName.csv");
//Code to display the Data
}
The CSV file looks like this:
Content of the row returned by the debugger when the error occurs: