I have static data in a single table which I must serialize. I have often read that a DataReader is more performant, if you wish to have read-only data that you traverse only once. If you wish to serialize this information however, would a DataTable be better?
Share
“Better” is a matter of trade-offs. Data from a data table can be “serialized” by using the
WriteXml()method. Problem solved.If you’re up to tuning the performance, you might get some mileage by writing a custom serializer for the reader, but you exchange development time for (we hope) improved performance.