Any particular reason behind taking the data type of config items as dictionary(string,object)
It depends on the values you are adding the config excel.
- If you have only string values to be configured ,you can use dictionary(string,string).
- If you have the combination of both numbers and text , you can go with dictionary(string,object).
Usually, when designing any system, web applications, desktop apps, mobile or any other, we come across several predefined configurations to be set in the application as you may already know. Usually these configurations are stored either ax xml files, or in excel or .config files… There can be many other file formats depending on the application we are develop.
Either way, when reading these configuration files, it is the best approach to use a dictionary variable to hold the configuration info. As you already know, Dictionary has two elements, the Key and the Value. These configuration stuff easily fits into this pattern. And every attribute it always defined by a unique name in any configuration. One other reason is, when these stuff are in a Dictionary format, we can easily access them without looping through the entire list of configs as we do in arrays, Lists etc.
In a dictionary, the data type we use depends on what type of configurations we have. The most common is the Dictionary(String, Object). String is used for the key of the dictionary because that is usually always a text value. However, for the value, it can be numeric, text etc. So, since we might deal with many types of data for values, we use it as Object because it usually can hold any type of data.
Does it help?