Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET Application Settings: Make an array of Color values
    primarykey
    data
    text
    <p>Usually you can make an array in the application settings by changing the data type manually in the code. However, System.Drawing.Color seems to be an exception. You can add it in the code as usually, and it even lets you edit the values in the graphical editor like other settings. It seems there is a problem serializing the data though, as it is subsequently lost.</p> <p>I then looked for methods in the code thinking the editor had got a bug in it somewhere, so tried this in the settings file:</p> <pre><code>&lt;Setting Name="ChannelColour" Type="System.Drawing.Color[]" Scope="User"&gt; &lt;Value Profile="(Default)"&gt;&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;ArrayOfColor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;color&gt;Cyan&lt;/color&gt; &lt;color&gt;DarkOrange&lt;/color&gt; &lt;color&gt;Magenta&lt;/color&gt; &lt;color&gt;LawnGreen&lt;/color&gt; &lt;/ArrayOfColor&gt; &lt;/Value&gt; &lt;/Setting&gt; </code></pre> <p>And likewise in app.config:</p> <pre><code>&lt;setting name="ChannelColour" serializeAs="Xml"&gt; &lt;value&gt; &lt;ArrayOfColor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;color&gt;Cyan&lt;/color&gt; &lt;color&gt;DarkOrange&lt;/color&gt; &lt;color&gt;Magenta&lt;/color&gt; &lt;color&gt;LawnGreen&lt;/color&gt; &lt;/ArrayOfColor&gt; &lt;/value&gt; &lt;/setting&gt; </code></pre> <p>I then didn't touch the editor and made sure any existing config files where gone. It still didn't work.</p> <p>Why is it that other arrays work fine, and Color values on their own are one of the default options, yet the combination doesn't work at all?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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