Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the preferred way to configure a mono application

When using VS, the preferred way to store user- and application settings seems to be to access VS "settings" tab for the given assembly and simply type the settings you need. Monodevelop does not have this feature (or at least I did not find it...)

What is the preferred way to do this under mono using monodevelop?

If the answer is "well, do the same - but hand-type the code needed" I'd love some pointers to a nice tutorial.

like image 393
Nils Avatar asked Nov 06 '22 02:11

Nils


1 Answers

On the mono list, John Ludlow had the answer I needed:

...First, the ConfigurationManager ( http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx ) will expose two section handlers by default...

If you want more complex configuration option then you can define your own handlers by inheriting from ConfigurationSection and ConfigurationElement.

See http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.aspx and http://msdn.microsoft.com/en-us/library/system.configuration.configurationelement.aspx.

You may also need to provide a class inheriting from ConfigurationElementCollection as well, if you want to be able to configure a collection of values.

Thanks to John and the people of the mono-list.

like image 90
Nils Avatar answered Nov 10 '22 18:11

Nils