What is the best format to store contact / address information without a database?
My application stores contact information. User can edit them with DataGridView etc. I am storing this contact information through a serializable class that looks like this:
[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 afraid this is not the most efficient / tidy format (if I just serialize the class). Has anyone had a similar problem and solved it better?
a source to share
There is nothing wrong with using Serializable
; this is a great way to get an object from and from disk. If you're worried about making the format human-readable, use XmlSerialize
r instead .
a source to share
I highly recommend VCard for the following reasons.
1.) Universal protocol for contacts. Makes your data instantly available to other VCard compatible applications. like MS Outlook.
2.) Can be transferred to mobile phones.
3.) Can be used for synchronization. [check SyncML sync.]
4.) You don't need to write the VCard parser yourself. Just check it out here Link Txt: http://www.codeproject.com/KB/dotnet/vCardReader.aspx
5.) Serializable.
a source to share
If you are sure that your application is the only one that will need to consume these serialized classes, the BinaryFormatter serializer will keep them pretty compact. If you can have other software utilities that would benefit from reading / writing these things, I would suggest you dump them as XML, either with SoapFormatter or with an XML serializer.
a source to share