Hemant Kothiyal
Hemant Kothiyal

Reputation: 4152

How can we write our own configuration in App.config

In one of my c# application, i have to write directories path inside config file as following

Main Folder = Sites
Sub Folders = 400, 500, 600, and so on
For each subfolders = Inst, Prof

Inside Inst and Prof , we have multiple files.

Inside my program, i have to fetch all sites (400, 500 etc) and then i have to write loop for all sites for both folders (Inst and Prof) one by one, once DONE then go for next site and so on

What is best way to write above folder structure in App.config file?

Upvotes: 2

Views: 1146

Answers (2)

shenhengbin
shenhengbin

Reputation: 4294

There is an easy way to create custom configure . custom-configuration-sections-in-3-easy-steps

Upvotes: 0

marc_s
marc_s

Reputation: 755321

You should check out Jon Rista's three-part series on .NET 2.0 configuration up on CodeProject.

Highly recommended, well written and extremely helpful! This will give you a thorough understanding of the .NET configuration system.

To design your own custom section, there's also a handy tool (Visual Studio add-in) called Configuration Section Designer that will make it very easy and simple to create your own custom section and have it build up all the necessary code to handle that custom section.

Upvotes: 4

Related Questions