Deserializing a Data Set
from Binary Data
You can
easily deserialized Binary Data into a DataSet. The BinaryFormatter object stores the schema automatically, so there is no need to load a schema
first. The BinaryFormatter object automatically identifies the file as having been saved as
BinaryXml or TrueBinary.
The
following code shows how to load the
binary file :
using System.Data;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace BinaryToDataSet
{
class Program
{
static void Main(string[] args)
{
DataSet vendorData;
FileStream fs = new FileStream(@"..\..\Customer.bin", FileMode.Open);
BinaryFormatter fmt = new BinaryFormatter();
vendorData = (DataSet)fmt.Deserialize(fs);
fs.Close();
}
}
}
DataSet containing Customer data :


Comments
Join the conversation! Your thoughts help the community grow.