AppConfig File C# Example

Understanding & Using AppConfig File

Let us say we are writing an Internet modem device monitor service application. The duty of the application will be tracking for Upload and download action of the modem. When there is a large download say 500KB per second for past 10 Minutes, the device should assert that to a user. The intimation can be done either by blinking a Red LED in the modem device or by making continues beep or by making the entire desktop with a red transparent overlay. But which option the utility should choose from? Now I hear you are saying keep it as an ‘Application Setting’. In C#, it is AppConfig file.

In old days, Legacy windows desktop software uses section-based Initialization Config Files (‘INI Files’) and App reads and writes from it. The coder places the settings on sections, which are nothing but organizing the settings under a certain group. Now in dot net days, Microsoft replaced the INI files as AppConfig files. They place the App settings in the XML format in application config files aka AppConfig file. In this article, we will explore how to make use of the AppConfig file. For exploring, we will create a simple C# Windows Form based example.