views:

65

answers:

1

Is there any way I can check in .net if my configuration file (I provide my own config) is proper without validating it against Xml Schema?

A: 

Have a look in the System.Configuration namespace. There is a class for reading the config settings which does this for you without great effort.

I'm fairly sure that the AppSettingsReader class will give you some good validation techniques. I usually just use the boilerplate code provided by the app settings in visual studio to do this though, if the file is invalid then the system will fall back onto defaults.

Spence
could you specify what class?
agnieszka