title: How can I use TypeConverters with a ConfigurationSection?
body: <p>So I've got a ConfigurationSection/ConfigurationElementCollection that has a configuration like this:</p>
  
  <pre><code>&lt;mimeFormats&gt;
      &lt;add mimeFormat="text/html" /&gt;
  &lt;/mimeFormats&gt;
  </code></pre>
  
  <p>And here is how I handle the mimeFormats:</p>
  
  <pre><code> public class MimeFormatElement: ConfigurationElement
  {
      #region Constructors
      /// &lt;summary&gt;
      /// Predefines the valid properties and prepares
      /// the property collection.
      /// &lt;/summary&gt;
      static MimeFormatElement()
      {
          // Predefine properties here
          _mimeFormat = new ConfigurationProperty(
              "mimeFormat",
              typeof(MimeFormat),
              "*/*",
              ConfigurationPropertyOptions.IsRequired
          );
      }
      private static ConfigurationProperty _mimeFormat;
      private static ConfigurationPropertyCollection _properties;
  
      [ConfigurationProperty("mimeFormat", IsRequired = true)]
      public MimeFormat MimeFormat
      {
          get { return (MimeFormat)base[_mimeFormat]; }
      }
  }
  
  public class MimeFormat
  {
      public string Format
      {
          get
          {
              return Type + "/" + SubType;
          }
      }
      public string Type;
      public string SubType;
  
      public MimeFormat(string mimeFormatStr)
      {
          var parts = mimeFormatStr.Split('/');
          if (parts.Length != 2)
          {
              throw new Exception("Invalid MimeFormat");
          }
  
          Type = parts[0];
          SubType = parts[1];
      }
  }
  </code></pre>
  
  <p>And obviously I need a TypeConverter that actually does something (instead of this empty shell):</p>
  
  <pre><code>public class MimeFormatConverter : TypeConverter
  {
      public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
      {
          throw new NotImplementedException();
      }
      public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
      {
          throw new NotImplementedException();
      }
  
      public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
      {
          throw new NotImplementedException();
      }
      public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>How do I set up a TypeConverter that will allow type conversion from/to string? I've tried using the MSDN examples but I keep getting error message:</p>
  
  <blockquote>
    <p>TypeConverter cannot convert from System.String.</p>
  </blockquote>
  
  <p>Essentially, how can it be set up so that it will just work with whatever ConfigurationSection is trying to do?</p>