title: Why doesn't object have an overload that accepts IFormatProvider?
body: <p>When converting for instance a <code>decimal</code> to a <code>string</code>, you use the <code>CultureInfo.InvariantCulture</code> and pass it as an <code>IFormatProvider</code>. But why is this overload not in <code>object</code>?</p>
  
  <p>A nice implementation would be:</p>
  
  <pre><code>public virtual string ToString()
  {
     // yadayada, usual ToString
  }
  
  public virtual string ToString(IFormatProvider provider)
  {
     return ToString();
  }
  </code></pre>
  
  <p>This would cause no harm or benefit to the <code>object</code> class, but objects deriving from it can instead override the overload and it will be a lot easier to call it when you are unsure of the type.</p>
  
  <p>The problem that made me run into this was when I was making a method that would be getting all properties of a class and writing it to xml. As I didn't want to check the type of the object, I just called <code>ToString</code>. But would this have been a decimal, the output would be based on the <code>CurrentCulture</code> of the thread, which is not optimal. The only workaround I can see is changing the <code>CurrentCulture</code> to <code>InvariantCulture</code> and then changing it back to whatever it was before. But that would just be ugly as I would have to write try finally blocks etc.</p>
  
  <p>My current code is:</p>
  
  <pre><code>        foreach (var property in typeof(Order).GetProperties(BindingFlags.Public | BindingFlags.Instance).
              Where(c =&gt; ValidTypes.Contains(c.PropertyType)))
          {
              var value = property.GetValue(order, null);
              if (value != null)
              {
                  writer.WriteElementString(property.Name, 
                  value.ToString());
              }
          }
  </code></pre>
  
  <p>But I would want it to be:</p>
  
  <pre><code>        foreach (var property in typeof(Order).GetProperties(BindingFlags.Public | BindingFlags.Instance).
              Where(c =&gt; ValidTypes.Contains(c.PropertyType)))
          {
              var value = property.GetValue(order, null);
              if (value != null)
              {
                  writer.WriteElementString(property.Name, 
                  value.ToString(CultureInfo.InvariantCulture));
              }
          }
  </code></pre>
  
  <p>Any benefit of not having this overload on <code>object</code>?</p>