Hello!
I was just about to implement an override of ToString() on a particular business class in order to produce an Excel-friendly format to write to an output file, which will be picked up later and processed. Here's what the data is supposed to look like:
5555555 "LASTN SR, FIRSTN" 5555555555 13956 STREET RD TOWNSVILLE MI 48890 25.88 01-003-06-0934
It's no big deal for me to just make a format string and override ToString()
, but that will change the behavior of ToString()
for any objects I decide to serialize this way, making the implementation of ToString()
all ragged across the library.
Now, I've been reading up on IFormatProvider, and a class implementing it sounds like a good idea, but I'm still a little confused about where all this logic should reside and how to build the formatter class.
What do you guys do when you need to make a CSV, tab-delimited or some other non-XML arbitrary string out of an object?