title: Implementing IConvertible interface
body: <p>I have custom type named <em>LocalizedString</em> and I need to implement <em>IConvertible</em> interface since when we serialize types to our DB we use <strong>Convert.ChangeType</strong> and I can't change this part of the code.</p>
  
  <p>What I did is I implemented: </p>
  
  <pre><code>string IConvertible.ToString(IFormatProvider provider)
  {
      return string.Format(this.ToString());
  }
  
  object IConvertible.ToType(Type conversionType, IFormatProvider provider)
  {
      return Convert.ChangeType(this.ToString(), conversionType);
  }
  
  public TypeCode GetTypeCode()
  {
      return TypeCode.Object;
  }
  </code></pre>
  
  <p>and I left all other methods with <em>NotImplementedException</em> since I dont have any reasonable conversions to other types. (I will eventually make them throw <em>InvalidCastException</em> , but thats another story.)</p>
  
  <p>However I still receive when I invoke <code>Convert.ChangeType(val, pr.__property.PropertyType)</code> where <code>val = ""</code> , <code>pr.__property.PropertyType = {Name = "LocalizedString" FullName = "Sampo.CMS.LocalizedString"}</code> code crashes with:</p>
  
  <blockquote>
    <p>Invalid cast from 'System.String' to 'Sampo.CMS.LocalizedString'.</p>
  </blockquote>
  
  <p>What do I need to do more? I am stuck.</p>