Standalone DataRow isn't Serializable

If you look up the DataRow class in the .NET Framework documentation you'll see this:

[Serializable]
public class DataRow

In the happy beleif that this was entirely true I designed my remoting interfaces with DataRow as parameter and return values to transport DataRow objects standalone. But no. I got a SerializationException and Malcolm Stewart with MS Developer support explains why in the adonet newsgroup:

The DataRow has no default constructor and no custom serializable method - either of which
would be required for what you want. In order for a DataRow to be
serialized, it must belong to a DataTable in a DataSet - the DataSet is
currently the smallest unit of data that can be serialized. We are aware of
this limitation and it is due to change in future versions of the product.

Please change this!

Filed under:

Comments

# Frans Bouma said:

afaik, a datatable can also be serialized.

Thursday, August 14, 2003 10:16 AM
# Mads said:

Yes, that's true. So probably the a detached DataTable with one row would be the preferred alternative? According to this article the table should be removed from the original or copied to remove the relation to the dataset.

Thursday, August 14, 2003 10:50 AM
# Jesse Ezell said:

Yah, I did this too on one of my very first .NET projects (during beta 2s).... very frustrating, although you can probably get around it by implementing ISerializable and doing the serialization manually.

Thursday, August 14, 2003 12:04 PM