Take the 2-minute tour ×

I am writing a program in C# that I plan to have rewritten in different programming languages, for other platforms (namely Mac OSX) in the future. The application needs to save some user-defined settings. My question is, should I save the settings file in such a format that can be read by any programming language, or should I use the app.config built into .NET?

Also what are the benefits of each?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Well, it depends on how you're planning on implementing it in different platforms. If you use Mono, for example, app.config would be fine. But otherwise, I'd consider using a more neutral file format. XML is the obvious option - particularly if it doesn't need to be hand edited. Or you could use JSON, or a simple key = value one-entry-per-line format.

Of course app.config is XML, but it's an XML format which is specific to .NET. The format used by app.config isn't one you'd normally come up with if you were creating your own settings file in general. I'm sure you'd be able to read an app.config file from other platforms without too much hassle, but it wouldn't be the most natural way of going about it.

Choice of format would partly be dictated by what the settings are - is a single unstructured list good enough, or would you benefit from the tree hierarchy given by XML, for example?

share|improve this answer
Thanks for your answer. I had considered using Mono but from what I have read it seems to struggling to keep up and lagging behind somewhat (correct me if I'm wrong). Is there a standard cross-platform format, other than XML which is unnecessary for me to store settings (such as ini)? –  Andy Aug 4 '13 at 20:13
@Andy: Well there's JSON - but personally I'd probably go for XML. You'll find an XML parser for just about any language. As for Mono lagging behind - it really depends on what you need. It's keeping up in terms of language support, but you won't find WPF for example. –  Jon Skeet Aug 4 '13 at 20:18
Typical. My app is WPF, is there any Mono-alternative that supports WPF? To be honest, at the minute my app only needs to save two file paths, so that's why I think it's overkill but I suppose looking at it like that, anything is overkill! I'll probably go with XML seeing as though it is most likely the most supported format, and I guess it will allow me to easily add more settings in the future. Just to clarify, you think that it is a good idea for the same program, on different platforms, to be able to use the same setting files? As opposed to forcing the user to create a different... –  Andy Aug 4 '13 at 20:45
...settings file on each platform? –  Andy Aug 4 '13 at 20:45
@Andy: Well you know your app better than we do - does it make sense to have shared settings, or would the user want different settings per installation anyway? How are you intending to let the user share those settings? Try to come up with a complete picture of how you want settings to be handled, rather than just focusing on the file format. –  Jon Skeet Aug 5 '13 at 5:43

Your Answer


