views:

104

answers:

2
+4  Q: 

App.Config or XAML

Hi ladies(?) and gents,

I am currently evaluating my options for a rewrite of the projects I'm working on and I am a bit miffed by the stringly-typed nature of our app.config files.

I'd like to move to a more structured approach, so I have two options:

  • Use custom SectionHandlers in the app.config
  • Scrap app.config and use XAML instead.

I'd like to get your opinions and horror stories on this, what are the pros and cons of using XAML for this?

Cheers, Florian

+2  A: 

If we are talking about config files I would use the app.config? Why? That's what it's meant for. If we are talking about resources (pictures, messages) I would put them in a XAML resource directory.

There is a guideline available on the web on where to put what, but was still in draft last time I checked and doesn't mention app.config afaik.

But do what works best for you :)

Snake
A: 

In terms of development effort is 6 of one half a dozen of the other.

If you use Xaml you will need to create a set of classes instances of which the Xaml will create.

If you using Custom SectionHandlers you will still need to create classes instances of which these sections will represent. You also need to create the SectionHandlers as well.

1 - 0 to Xaml.

In the case of Xaml though you will need to provide your own infrastucture to load the xaml at startup and access the configuration throughout your app.

On the other hand using Section Handlers the existing .NET ConfigurationManager provides the infrastrucure to access these.

1 all

AnthonyWJones
When the next guy comes and reads your code, he'll understand what you're doing with custom section handlers. He'll get a WTF moment with the XAML. 2-1 config.
Matt Dotson