Best practices for fixed-width processing in .NET

Posted by jmgant on Stack Overflow See other posts from Stack Overflow or by jmgant
Published on 2009-03-31T14:04:18Z Indexed on 2010/05/14 13:14 UTC
Read the original article Hit count: 508

I'm working a .NET web service that will be processing a text file with a relatively long, multilevel record format. Each record in the file represents a different entity; the record contains multiple sub-types. (The same record format is currently being processed by a COBOL job, if that gives you a better picture of what we're looking at). I've created a class structure (a DATA DIVISION if you will) to hold the input data.

My question is, what best practices have you found for processing large, complex fixed-width files in .NET? My general approach will be to read the entire line into a string and then parse the data from the string into the classes I've created. But I'm not sure whether I'll get better results working with the characters in the string as an array, or with the string itself. I guess that's the specific question, string vs. char[], but I would appreciate any other pointers anyone has.

Thanks.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about fixed-length-record