Custom type and settings: the designer will not write the value of the app.config parameter

Here is what I want to do:

  • Sets the application settings parameter, the value of which is an array of custom type
  • Have an array of custom type serialized in XML, as opposed to a string
  • Get the serialized value of my parameter stored in app.config.

So far it eludes me

I have my own type:

[TypeConverter(typeof(ServiceConfigurationConverter))]
[Serializable]
public class ServiceConfiguration
{
    public string Name { get; set; }
    public string Url { get; set; }
    // more
}

It has a custom TypeConverter that converts it back and forth from a string. I wrote it this way because the examples I found were intended to be converted to strings and because I would like to serialize a string if it meant that my values ​​were stored in app.config. But, as we shall see, this is not so.

( Settings.settings), MyNamespace.ServiceConfiguration[], XML . ( XML, , , XmlSerializer.) , XML Settings.designer.cs , app.config.

, , XML app.config , . app.config, .

app.config, applicationSettings , , , - , applicationSettings.

- , , , .

( , "string", XML . , , - , . 'd, .)

- , ?

.

+5

All Articles