My application is storing contact information. User can edit them through DataGridView and so on. I’m saving those contact info through serializable class which looks like that:
[Serializable]
public class Contact : INotifyPropertyChanged
{
private string _fName;
private string _lName;
private string _pNumber;
public event PropertyChangedEventHandler PropertyChanged;
public Contact(string firstName, string lastName, string phoneNumber, bool fromOutlook){...}
public Contact(){...}
public string FirstName{...}
public string LastName{...}
public string PhoneNumber{...}
private void NotifyPropertyChanged(string name){...}
}
But I’m affraid it’s not the most efficient / neat format (if I just serialize the class).
Does anyone had similar task and solved it in a better manner?
There’s nothing wrong with using
Serializable; it’s a great way to get an object to and from disk. If you’re worried about making the format human-readble, useXmlSerializer instead.