I have such dictionary Dictionary<string, object>, dictionary holds string keys and objects as values. I need to save and later load such dictionary. What would be best method to do that?
I have such dictionary Dictionary<string, object> , dictionary holds string keys and objects as
Share
You can use this serializable
Dictionary<TKey, TVal>(tested):http://www.dacris.com/blog/2010/07/31/c-serializable-dictionary-a-working-example/
write it to a file:
read it from a file:
Note: Of course you don’t need to create a second
Dictionary. You can use theSerializableDictionaryat the first place. That should just demonstrate how to use it with an already existing Dictionary.