ASP.NET Profile Properties and Complex Types
<p>I require to store Users checkbox selection so the checkboxes are disabled/enabled when User logs back in. Please note that number of checkboxes displayed is dynamic.</p>

<p>Following is what I used in my web.config.</p>

<pre><code>&lt;add name ="checkBoxListTest" type="System.Collections.Specialized.StringDictionary" serializeAs="Xml" /&gt;
</code></pre>

<p>However when I used </p>

<pre><code>public StringDictionary TestCheckBoxValues
        {
            get { return Profile.GetPropertyValue("checkBoxListTest") as StringDictionary; }
        }
if (TestCheckBoxValues != null)
    var x = TestCheckBoxValues;
</code></pre>

<p>I get the following error</p>

<p><strong>To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. System.Collections.Specialized.StringDictionary does not implement Add(System.Object).</strong></p>

<p>Can anyone explain whats going on?</p>

<p>Also I decided to use a List
where UserDefinedClass would be serializable key/value pair. However how do I get that in  the web.config, for example</p>

<pre><code>&lt;add name="checkBoxListTest2" type ="List&lt;UserDefinedClass&gt;"/&gt;
</code></pre>

<p>would htmlencoding the '&lt;' and '>' characters work?</p>

<p>Another solution would be to create a subclass that would inherit from List to hide the '&lt;' and '>' characters.</p>

<p>Would this be the best solution?</p>

<p>Thanks for you help.</p>
