开发者

Settings File as Dictionary with Serialization

This is a three part question.

One: Would using a

Dictionary<String,Object>

be a good way of saving data where it would be

Dictionary<Key,Value>

as the basis?

Two: What would be a better way without using app.settings or xml?

Three: How would you serialize this(Or the better solution) into a binary format that is compact and serializes quickly?


Xml is very verbose and I was looking for binary due to it's size.

Also, if I used Dictionary, it would have bee开发者_StackOverflow社区n easy to make a settings class with simply

GetValue(Key) and SetValue(Key,Obj)
or object.SetValue(Settings,Key) using extensions.

I am making my application open for plugins so I wanted a uniform spec for settings that all applications use.

Rolling my own class using Dictionary as the basis made sense if I could serialize it into a file.


Try using protobuf-net. This would solve all three of your problems. I looked at it last week, and replaced my entire xml-based messaging infrastructure in just a couple of days. Marc Gravell is a frequent contributor on here, and he was very prompt and helpful in his replies to my queries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜