Is a binary-serialized DataSet versioning tolerant?

M

Martin Koch

1st I serialize a DataSet (contains 14 DataTables) into file, with
BinaryFormatter.
2nd I change some columns in a DataTable.
3rd When I now Deserialize the DataSet from bin file got I problems ??

Thanks in advance
 
I

Ignacio Machin ( .NET/ C# MVP )

1st    I serialize a DataSet (contains 14 DataTables) into file, with
BinaryFormatter.
2nd   I change some columns in a DataTable.
3rd    When I now Deserialize the DataSet from bin file got I problems??

Thanks in advance

Yu will get the same dataset that when you serialized it the first
time.
 
I

Ignacio Machin ( .NET/ C# MVP )

1st    I serialize a DataSet (contains 14 DataTables) into file, with
BinaryFormatter.
2nd   I change some columns in a DataTable.
3rd    When I now Deserialize the DataSet from bin file got I problems??

Thanks in advance

Just to add, you will get the same result using any other
serialization method.

Remember, you will get a NEW instance of a Dataset (which contains all
the dattables) . It has no knowledge that the "original" instance
changed.
 
M

Martin Koch

Ignacio Machin ( .NET/ C# MVP ) said:
Yu will get the same dataset that when you serialized it the first
time.

Thanks for the answer!

I have done the following:
....
BinaryFormatter f = new BinaryFormatter();

using ( FileStream fs = new FileStream( @"MyFile.bin", FileMode.Open ) )
{
dsDes = (DataSet1)f.Deserialize( fs );
}

The cast (DataSet1) works although I have deleted a column in a DataTable
in the DataSet1 before I called the Deserialize() function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top