Robert Wilkinson
Robert Wilkinson

Reputation: 1199

Dump C# DataTable to a file

Is there a quick and dirty way to dump the contents of a System.Data.DataTable to a text file or some other 'thing' for debugging purposes?

Upvotes: 6

Views: 5758

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499770

DataTable.WriteXml(string) will write it to a file...

myDataTable.WriteXml(filename);

It may not be as compact as you could desire, but it'll have the information you need...

Upvotes: 14

Related Questions