Adding and reading from a Config file

后端 未结 3 1399
执念已碎
执念已碎 2020-12-04 10:40

I have created a C# console based project. In that project i have some variables like companyName, companyType which are Strings.

3条回答
  •  执念已碎
    2020-12-04 10:48

    1. Right click on the project file -> Add -> New Item -> Application Configuration File. This will add an app.config (or web.config) file to your project.

    2. The ConfigurationManager class would be a good start. You can use it to read different configuration values from the configuration file.

    I suggest you start reading the MSDN document about Configuration Files.

提交回复
热议问题