Search code examples
javac#settingsproperties-file

Java .properties file and C# .settings file


I'm working on converting a Java code to C#.

The Java code writes and reads 3 key pieces of data in the application into a .properties file. This may even go on for several hundred lines.

Properties prop = new Properties();

I have looked at several C# replacements for .properties files and I've come up with 3 possibilities.

.settings .ini .config

From the non-existent experience I have with these 3 file types, I was thinking that .settings is what I need.

Please correct me if I'm wrong and give me some info on how to work with the best file type. (I've looked into reading and writing to .settings files and there's not much to go on)

Thanks all!


Solution

  • In Visual Studio you would replace that with .settings indeed. If you right click the project and choose to properties then select the Settings tab and you have a nice link to create one if not already there. you can obviously create one using the "add new item"

    It can hold standard type such as string, int, double and even more complex one such as Datatable and even custom object

    Adding to this, settings also have a scope where you can define at user or application level.