In WCF, sometimes we get a ByteArray as an output data contract and we want to deserialize that ByteArray into a DataTable.
Here we could get an idea how we can deserialize a ByteArray into DataTable. DataTable becomes useful int the situations when we want to save data into database using DataAdapter by passing a DataSet.
In this code, we create a MemoryStream object by passing byte array and then using BinaryFormatter, we can directly deserialize MemoryStream object into DataTable.
While adding at line dt = (DataTable)bformatter.Deserialize(stream); getting error ------ The input stream is not a valid binary format. The starting contents (in bytes) are: 7B-22-47-65-74-45-6D-70-6C-6F-79-65-65-52-65-73-75 ...
Shishu SinghPosted Jan 26, 2018, 6:00 AM EST
While adding at line dt = (DataTable)bformatter.Deserialize(stream); getting error ------ The input stream is not a valid binary format. The starting contents (in bytes) are: 7B-22-47-65-74-45-6D-70-6C-6F-79-65-65-52-65-73-75 ...