[C#] Basic setting file that easy to extend using JSON
Posted in : Technologies on by : zquanghoangz Comments: Tags: C#, JSON, Setting
When we create an application then want to keep all the user settings from the last run, the method that I usually use is create a setting file that store keys, values data.
In this post, I show an example how to do it and it’s kind of reusable code for your next application.
Here are code then explanations:
The ISettings interface and Settings class is the model that present all setting keys values that you want to store in setting file. This part is what I describe by extendable. You can add, update and delete properties in the interface to those configures that your application needed.
The SettingFactory class, mostly don’t need to change, that provide Load and Save setting for your application. In here, you can change the setting file name or use the default one, that quite flexible for using in an application.
Thank for your reading.