Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Agreed with Thomas Levesque:</p> <p>The following class was correctly saved/read back:</p> <pre><code>public class Foo { public string Name { get; set; } public string MashupString { get; set; } public override string ToString() { return Name; } } </code></pre> <p>Note: I didn't need the <code>SerializableAttribute</code>.</p> <p><strong>Edit:</strong> here is the xml output:</p> <pre><code>&lt;WindowsFormsApplication1.MySettings&gt; &lt;setting name="Foos" serializeAs="Xml"&gt; &lt;value&gt; &lt;ArrayOfFoo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;Foo&gt; &lt;Name&gt;Hello&lt;/Name&gt; &lt;MashupString&gt;World&lt;/MashupString&gt; &lt;/Foo&gt; &lt;Foo&gt; &lt;Name&gt;Bonjour&lt;/Name&gt; &lt;MashupString&gt;Monde&lt;/MashupString&gt; &lt;/Foo&gt; &lt;/ArrayOfFoo&gt; &lt;/value&gt; &lt;/setting&gt; &lt;/WindowsFormsApplication1.MySettings&gt; </code></pre> <p>And the settings class I used:</p> <pre><code>sealed class MySettings : ApplicationSettingsBase { [UserScopedSetting] public List&lt;Foo&gt; Foos { get { return (List&lt;Foo&gt;)this["Foos"]; } set { this["Foos"] = value; } } } </code></pre> <p>And at last the items I inserted:</p> <pre><code>private MySettings fooSettings = new MySettings(); var list = new List&lt;Foo&gt;() { new Foo() { Name = "Hello", MashupString = "World" }, new Foo() { Name = "Bonjour", MashupString = "Monde" } }; fooSettings.Foos = list; fooSettings.Save(); fooSettings.Reload(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload