I found this one the hard way, http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=295677[^]. After writing and testing a bunch of code that relied on reading from persisted DataTables one of our test databases had columns with single spaces. While this post discusses .NET 3.0 I am seeing the behavior in .NET 2.0. I have not tested to see if it is fixed in any later versions.
However, if I read the same file, which is still persisted with a DataTable object (DataTable.WriteXml()), into a DataSet object instead and use the first DataTable in the DataTableCollection the whitespace is [appears to be, for me anyway] preserved properly in the DataTable
DataSet someData = new DataSet();
someData.ReadXml("somepersistedDataTable.xml");
//
DoSomethingToDataTable(someData.Tables[0]);
//
void DoSomethingToDataTable(DataTable dt)
{
}
Not sure if this is the correct place, or a repost for that matter, but wanted to share just in case someone else was having similar issues.