I use the ServiceStack.Text library to read from CSV files in C #.
I would like to know how to deserialize a CSV for objects where the CSV contains a space-separated space?
I use this code to deserialize CSV in empClass :
List<empClass> objList = File.ReadAllText(filePath).FromCsv<List<empClass>>();
If I have a csv file like this
EmpId,Employee Name,Employee Address
12,JohnSmith,123 ABC Street
and my class is like
public class empClass{
public string EmpId;
public string Employee_Name;
public string Employee_Address;
}
It fills in EmpId but does not fill in Employee Name and Employee Address , because it contains a blank space in the header.
We will be grateful if someone can help.
source
share