Building a JSON Configuration Section

后端 未结 5 1404
轮回少年
轮回少年 2021-02-18 20:37

Is there a way to have configuration sections written in JSON instead of XML?

Let\'s suppose I have the following ConfigurationSection:

publ         


        
5条回答
  •  走了就别回头了
    2021-02-18 21:20

    You can change your own UsersConfig class that it will be able to serialize and deserialize to JSON. Then write another class that will retrieve configuration from your file. In app.config you can add single setting that will point you to the place where you store your json config.

    You can achieve this easily by using Json.Net and adding attributes to your UsersConfig class.

提交回复
热议问题