c# – working with my business object offline – Education Career Blog

I’m working on a single business object that gets data from my database. I was wondering if there was a quick way to serialize it to a text file or something so I won’t have to keep connecting to the db. Also, want better performance because it takes a good minute to build the object.




XmlSerializer is an easy way: http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx. This serializes your objects to XML.

However, if you require the best performance, have a look at http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter.aspx. This serializes your objects to a binary format which has better performance and allows greater flexibility in what you can serialize.

Leave a Comment