Click to See Complete Forum and Search --> : Persistent Program Data


MCRoberts
April 30th, 2005, 03:44 PM
Greetings:

I'm just wondering what the accepted way of storing persistent program settings are under .NET and C#. Things like directory settings, screen coordinates and all that. Are we using INI files still? The registry? Or has .NET got something new?

Could you please refer me to the classes or interfaces I should look at to accomplish this end?

Thank you,
Mark

miteshpandey
May 1st, 2005, 12:28 PM
I would not recommend Registry to store Program Data.

You can use XML documents.

Siddhartha
May 1st, 2005, 03:48 PM
I would not recommend Registry to store Program Data. Why not? ;)

Many applications (and not only Windows) do keep data in the Registry (that is what it is for!)

Registry is well suited for storing Application Settings (as the OP indicates), etc - especially on a per User Basis

Look up -

RegCreateKey (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/regcreatekey.asp) to insert a key in the Registry.
Registry Overview (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry.asp)
Registry Functions (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry_functions.asp)

You can use XML documents. Yes - but, that depends on the nature of the information being stored.

XML is not suited to all kinds of information storage (for example storing a flag!).