I am using csv reader
for c#.
This is my Record
class
internal class Record
{
int _y;
int _x;
[Name("y")]
public int y { get; set; }
[Name("x")]
public int x { get; set; }
public int getSum()
{
return _x+_y;
}
}
Then, I try to read multiple .csv files and write aggregate to 1 .csv file
using (var writer = new StreamWriter(SaveTxt.Text))
using (var csvOut = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
for (int i = 0; i < Int16.Parse(numberFile); i++)
{
using (var reader = new StreamReader(files[i]))
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
{
var records = csv.GetRecords<Record>();
csvOut.WriteRecords(records);
}
}
}
But the result only show x
and y
data. Without showing result from getSum()
function. What should I do to be able to manipulate the data that I read from .csv before write to other .csv ?