0

Hey everyone,

Usually when I create a Java application I will use the built-in Preferences class to save user preferences. I believe this saves user information to the registry on Windows, and to other locations on Linux / Mac OS X.

When I need to store a serialised object, I'm forced to store to a file - but that is the only time I generally save settings to a file.

My question - as I'm fairly new to C# development - is if there is something similar to Java's Preferences class in C#. What is the most highly-recommended way to store user preferences? Is it simply to write them to a file, or is there an alternative (that is more invisible to the user).

And if storing to a file is the recommended option - could you please give the name of any classes that you'd recommend I use? With the class name, it should only take me a few minutes to find some code explaining how to use it, so it'd be a good starting point for me. Perhaps some file reader/writer classes, and an XML reader/writer class.

Like I said above, I'd prefer to avoid writing to a file - unless that is the only option available.

Thanks for your time.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by leiger
1

Read this. They are stored in an XML file. Microsoft recommends that you no longer use the registry for settings.

Edited by Momerath: n/a

0

Read this. They are stored in an XML file. Microsoft recommends that you no longer use the registry for settings.

So it is possible to write to the registry, but it is not recommended? Thanks - this is exactly what I wanted to know :)

That link you gave me seems to be what I want. And from a quick skim read, it seems I can store serialised objects that way as well.

Thanks again!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.