Here's the data I want to read:
"Adam C. Emality","1Z620Y1V034826","14.40"
"Ethel Baeron","1Z620Y1V034604","15.19"
"Donna Lidt","1Z620Y1V034650","12.37"
Then after reading the data in, I want to perform a Join on the two collections, one an array and one a list - my code below. However after executing the read file line my strings are stored like this "\"Adam C. Emality\""
"\"1Z620Y1V034826\""
"\"14.40\""
...etc.. Why is this happening? I do not want to include the "
and I don't know why it is adding in a \
.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FileHelpers;
using Parser;
namespace Amazon_File
{
class SpreadSheet
{
public void create(IEnumerable<SpreadList> list)
{
var steamengine = new FileHelperEngine<Records>();
var records = steamengine.ReadFile(@"C:\Users\Danny\Documents\Visual Studio 2013\Projects\Amazon File\Amazon File\Daniel.csv");
var spreadlist = from x in list
join y in records on x.Name equals y.Name
select new { y.Name, y.Track, y.worldPrice, x.ItemPrice, x.Quantity };
[DelimitedRecord(",")]
public class Records
{
public string Name;
public string Track;
public string worldPrice;
}
public class SpreadList
{
public string Name { get; set; }
public string Title { get; set; }
public string ItemPrice { get; set; }
public string Quantity { get; set; }
}
}
You must add [FieldQuoted] to make the library auto remove them http://www.filehelpers.net/docs/html/T_FileHelpers_FieldQuotedAttribute.htm
[DelimitedRecord(",")]
public class Records
{
[FieldQuoted]
public string Name;
[FieldQuoted]
public string Track;
[FieldQuoted]
public string worldPrice;
}