>> I'm wrting a program that will take a CSV file and perform a number of
>> check on the fields in the lines.
>> The field values can be strings and numbers .
>> Can someone advice on the best approach to deal with this?
>
> It's a little difficult unless you actually tell the group what checks you
> intend to perform...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
Well,
I'm just thinking of the way to arrange the logic that does the checks the
checks. The actual check could be a range check on the numbers, or looking
up a name in a database. But i thought this would not really matter. Well,
it is obvious that i could write a method to check each field but this does
not sound "Generic" to me. I think there must be more clever approches maybe
something similar to a way compilers parse code lines?
No worries about the actual CSV parsing of the file as i will use linq to
do this in the way shown below:
varquery = from line in
File.ReadAllLines(FileName)where!line.StartsWith("#")letparts=
line.Split(',')select
new{
ISBN = parts[0],
Title= parts[1],
Publisher = parts[2],
Cheers
S