Reputation: 93
My application uses DataRows and they are not serializable. Is there a workaround for the same?
Upvotes: 2
Views: 1034
Reputation: 4244
You could try to create a List<object>
.
Then fill the List scanning DataRows
, and serialize List.
Upvotes: 2
Reputation: 1
DataTable dt = dataRow.Table.Clone();
dt.ImportRow(dataRow);
dt.AcceptChanges();
string xml = string.Empty;
using (var writer = new StringWriter())
{
dt.WriteXml(writer);
xml = writer.ToString();
}
Upvotes: 0
Reputation: 19479
Put them into a data table and that into a dataset. That should serialize correctly.
Upvotes: 3