title: Why does my class not behave exactly like the overridden base class?
body: <p>My application has a <code>ComboBox</code> and had an application setting <code>myStrings</code> of the type <code>System.Collections.Specialized.StringCollection</code>. I bound the <code>ComboBox.ItemSource</code> to <code>Properties.Settings.Default.myStrings</code>. The ComboBox displayed the items of myStrings, as I planned.</p>
  
  <p>Unfortunately the ComboBox did not update the items, when myStrings changed. So I tried to create a new class <code>CustomStringCollection</code> that overrides StringCollection and implements <code>INotifyPropertyChanged</code>.</p>
  
  <p><strong>The setting is not properly saved. I did expect that <code>CustomStringCollection : StringCollection</code> does behave exactly like it's base class, including when it is saved. Why is it not the same?</strong></p>
  
  <p>This is the settings file and you can see that myStrings-values are saved, but myCustomStringCollection-values are not:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      …
      &lt;userSettings&gt;
          &lt;comboBoxDataBinding.Properties.Settings&gt;
              &lt;setting name="myStrings" serializeAs="Xml"&gt;
                  &lt;value&gt;
                      &lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
                          &lt;string&gt;Banana&lt;/string&gt;
                      &lt;/ArrayOfString&gt;
                  &lt;/value&gt;
              &lt;/setting&gt;
              &lt;setting name="myCustomStringCollection" serializeAs="Xml"&gt;
                  &lt;value /&gt;
              &lt;/setting&gt;
          &lt;/comboBoxDataBinding.Properties.Settings&gt;
      &lt;/userSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This is the class comboBoxDataBinding:</p>
  
  <pre><code>using System.ComponentModel;
  using System.Configuration;
  using System.Reflection;
  
  namespace comboBoxDataBinding {
      [DefaultMember("Item")]
      [SettingsSerializeAs(SettingsSerializeAs.Xml)]
      class CustomStringCollection : System.Collections.Specialized.StringCollection, INotifyPropertyChanged {
          public event PropertyChangedEventHandler PropertyChanged;
  
          private void OnPropertyChanged(string v) {
              if (PropertyChanged != null) {
                  PropertyChanged(this, new PropertyChangedEventArgs(v));
              }
          }
      }
  }
  </code></pre>
  
  <p>And this is how I saved those settings:</p>
  
  <pre><code>Properties.Settings.Default.myStrings.Add("Banana");
  Properties.Settings.Default.myCustomStringCollection.Add("Banana");
  Properties.Settings.Default.Save();
  </code></pre>