-
Notifications
You must be signed in to change notification settings - Fork 137
QuickFixedLengthLoad
Cinchoo edited this page Jun 24, 2017
·
14 revisions
To load FixedLength file, use ChoFixedLengthReader component to parse it. Sample below shows how to load FixedLength file (Emp.txt)
Id Name
1 Carl
2 Mark
foreach (dynamic e in new ChoFixedLengthReader("Emp.txt").WithFirstLineHeader())
Console.WriteLine("Id: " + e.Id + " Name: " + e.Name);
var reader = new ChoFixedLengthReader("Emp.txt").WithFirstLineHeader();
dynamic rec;
while ((rec = reader.Read()) != null)
Console.WriteLine("Id: " + e.Id + " Name: " + e.Name);
foreach (var e in new ChoFixedLengthReader("Emp.txt").WithFirstLineHeader().WithField("Id", 0, 8).WithField(8, 10))
Console.WriteLine("Id: " + e.Id + " Name: " + e.Name);
public partial class Employee
{
[ChoFixedLengthRecordField(0, 8)]
public int Id { get; set; }
[ChoFixedLengthRecordField(8, 10)]
public string Name { get; set; }
}
foreach (var e in new FixedLengthReader<Employee>("Emp.txt"))
Console.WriteLine("Id: " + e.Id + " Name: " + e.Name);
Please visit below article for detailed walk-through of Flat (FixedLength) file reader
©2017 Cinchoo Inc