I have a string like this:
A00601 CALLE FCO PIETRI CALLE FRANCISCO PIETRI A20040407
Is there a way to replace this code:
foreach (var line in parsedList)
{
if((line[0] == 'D') && (line[55] == 'Y'))
{
item.PostalCode5 = line.Substring(1, 5);
item.PreferredCityName28 = line.Substring(13,28);
...
}
}
With a LINQ query like this:
foreach (var line in parsedList)
{
item.PostalCode5(line.Substring(1, 5)),
item.PreferredCityName28(line.Substring(13,28))
...
.Where (line[0] == 'D' && line[55] == 'Y')
}
D