Tag archive for: Data persistence

How to save and load objects to and from file in C#

Persistency is almost always a requirement for applications that are meant for serious usage. Perhaps we want the data that our C# program had harvested or generated to be available everytime it runs. Or for that load of data that we are unable to send to a server to be remembered, so that we can try sending at a later time.

Because most of the data that is held by a C# application at runtime is in the form of objects, it is convenient to be able to save and load objects to file directly. Such capability is dubbed object serialization, and like many other programming languages, C# has the facilities to perform object serialization for developers.