Peter

Peter

  • NA
  • 14
  • 26.1k

Convert.ToString custom class

Sep 27 2012 1:16 PM
Hi

I have a class which uses Convert.ToString(o, CultureInfo.InvariantCulture), to convert the "object" o to a string. (This works fine for ints and doubles for example).

However, when I pass a custom class as 'o' I can't seem to get the results I want. I override ToString - and this is called. But how do I tell "Convert" to call my custom class method which is called ToString(IFormatProvider fp)?

Thanks,
Peter


Answers (2)