Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top