I'm using the CsvHelper library tool to help write lists that I've created to CSV file.
using (var sr = new StreamReader(inPath))
{
using (var sw = new StreamWriter(outPath))
{
var reader = new CsvReader(sr);
var writer = new CsvWriter(sw);
IEnumerable records = reader.GetRecords<DataRecord>().ToList();
List<CountAndFrequencyClass> list1 = new List<CountAndFrequencyClass>();
list1 = CountAndFrequency(records, "ShipperName", 1);
List<CountAndFrequencyClass> list2 = new List<CountAndFrequencyClass>();
list2 = CountAndFrequency(records, "ShipperCity", 1);
list1 = list1.Concat(list2).ToList();
writer.WriteRecords(list2);
}
}
The list1=list1.Concat(list2).ToList(); does indeed concatenate the strings, but it stacks them on top of each other when they're written out to the CSV file. I want to find a way to concatenate the lists horizontally (so they're displayed next to eachother) instead of vertically.
Thanks for any help and please let me know if additional information is needed!