简体   繁体   中英

Properties file as simple as in Java?

I am looking for a simple way to use values written in my properties.resx file in C#. In Java, this is really simple since you have a file .properties .
I need such file to write my constant strings inside as if I want to change a constant, I just have to change it in that file. Anyone has an example?

Thanks in advance.

In .NET we typically don't use a resx file to store settings like you describe, we use a settings class. Go to the properties for your project and click on the Settings tab. Create your settings there and they'll be written to the app.config/web.config where they can be overridden. You can then access the values using Settings.Default.NameOfSetting .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM