The XmlConvert.ToString
methods are locale independent so the string representation will be consistent across different locales. With Object.ToString
you may get a different representation according to the current culture associated with the thread.
So using one versus the other is a matter of the scenario, XmlConvert
lends well if you're exchanging data with another system and want a consistent textual representation for example a double
value.
You can see the differences in the following example:
double d = 1.5;
Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-PT");
Console.WriteLine(d.ToString()); // 1,5
Console.WriteLine(XmlConvert.ToString(d)); // 1.5
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Console.WriteLine(d.ToString()); // 1.5
Console.WriteLine(XmlConvert.ToString(d)); // 1.5