I was writing an app in which i needed to store a dictionary..
I thought to post the code..:
public void StoreDictionary(Dictionary<string,FileInfo> files)
{
FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, files);
fs.Close();
}
public Dictionary<string, FileInfo> RetrieveDictionary()
{
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryFormatter bf = new BinaryFormatter();
Dictionary<string,FileInfo> filedic=(Dictionary<string, FileInfo>)bf.Deserialize(fs);
fs.Close();
return filedic;
}..................................................
But for my app,I need to access,update and query the dictionary at very rapid rate..
Serializing and deserializing ,again and again is Just Impossible in my app.
So, i am choosing a better option, a light ,easy but powerful database..
And the only database that comes to my mind for this is db4o.....
.http://www.db4o.com
Its the easiest yet powerful Object oriented Database and that too Open Source..
With just 2 lines,u can store an object.
But i don't think i can store a dictionary(Collection) directly...Insead.. I will store key value pairs from dictionary in the database...That Way ,I can query,Update without any significant overhead..
I really like db4o personally....U should all check out before using any other one...