Lesson 10 - Birthday reminder in C# .NET WPF - Serialization
In the previous lesson, Birthday reminder in C# .NET WPF - Bindings, we finished adding bindings to our birthday reminder application in C# .NET WPF. The only thing missing is saving the person list to a file and loading it later. That way, the data won't be lost after the application is terminated.
Let's add a private attribute to the PersonManager class that will contain the path to the file where the data will be saved:
private string path = "persons.xml";
Now, let's add two more methods to the Person class - Save() and Load().
To save the ObservableCollection contents to a file we'll use the
...End of the preview...
You've come here and that's great! We believe that the first lessons showed you something new and useful
Do you want to continue the course? Go to the premium section.
Buy this course
Before buying this article, you have to buy the previous one
- Unlimited and permanent access to individual lessons.
- High quality IT knowledge.
- Skills to help you get your dream and well-paid job.
Requested article covers this content:
In this lesson, we'll finish our C# .NET WPF birthday reminder app, and learn how to serialize/deserialize an ObservableCollection to/from an XML file.
You gain credits by supporting our network. This is done by sending a helpful amount of money to support the site, or by creating content for the network.