-1

I am translating some code from Java to C# and I need to translate the Properties class from Java to C#. For that, I need to configure the app.config file in C# but I am not able to understand what the key and value to be added should be. For example: One of the methods involving properties class in java that I have to translate is:

static public Properties putPrefixToProperties (String prefix, Properties pro)
{
    Enumeration en;
    Properties res = new Properties();

    en = pro.propertyNames();

    for (; en.hasMoreElements();)
    {
        String nom = (String) en.nextElement();

        res.setProperty (prefix+nom, pro.getProperty (nom));
    }

    return res;
}

Any updates on how to translate such code would be very helpful. Thanks!

Saniya
  • 59
  • 3

1 Answers1

0

As csharpfolk has written: You may use AppSettings. In your code you may access the settings using:

Properties.Settings.Default.propertyName

This works for application settings (readonly) and user settings (read / write).