private static string ConstructHeader(RecordDefinition recordDefinition)
{
var header = new List<string>();
int currentPosition = 0;
foreach (FieldDefinition fieldDefinition in recordDefinition.Fields)
{
while (currentPosition < fieldDefinition.StartPosition)
{
header.Add(string.Empty);
currentPosition++;
}
header.Add(fieldDefinition.Label);
currentPosition++;
}
return string.Join(recordDefinition.FieldSeparator, header);
}