Click button to edit
QuickStart: Autoproperties
You can use autoproperties instead of fields
If you have a source file like this, separated by a |:
Input.txt
10248|VINET|04071996|32.38
10249|TOMSP|05071996|11.61
10250|HANAS|08071996|65.83
10251|VICTE|08071996|41.34
You can use autoproperties but for the moment you can't use Converters
RecordClass.cs
[DelimitedRecord("|")]
public class Orders
{
public int OrderID { get; set; }
public string CustomerID { get; set; }
public string OrderDate { get; set; }
public string Freight { get; set; }
}
Example.cs
var engine = new FileHelperEngine<Orders>();
var records = engine.ReadFile("Input.txt");
foreach (var record in records)
{
Console.WriteLine(record.CustomerID);
Console.WriteLine(record.OrderDate);
Console.WriteLine(record.Freight);
}
Console
VINET
04071996
32.38
TOMSP
05071996
11.61
HANAS
08071996
65.83
VICTE
08071996
41.34