Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm not necessarily referring to app.configs, but a custom configuration file that would store my program's state whenever a user hits a "save" button.

In my example, it's a UI builder that allows the user to choose which "fields" are to be displayed on the left and right columns in a two-column screen, along with the order of the fields in each column. There's other stuff too, but you get the idea.

The user could open any configuration file they've saved and populate the UI builder appropriately.

I'm thinking this could be stored in an XML file, but I was wondering what sort of suggestions people would have on how to write it out, how to read from it (use LINQ maybe?) and other general approaches, including versioning etc. I'm sure this has come up before and I'd like to hear about best practices. Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
936 views
Welcome To Ask or Share your Answers For Others

1 Answer

Does it have to be somewhat human readable? Or does the user not care... just save my settings... and let me reload them later?

If not, just create/design a bunch of objects with meaningful properties... create instances... and serialize (binary or soap or custom) the object to disk. Then, you can always "re-hydrate" your object later from disk.

When possible, I always like to not reinvent the wheel. Let the framework do the work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...