purpose of XmlConvert.ToString() ???

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

HI,

what is the purpose of XmlConvert.ToString() ?
why not just use Convert.ToString() ?

e.g.
Int32 vInt32 = -2147483648;
string s1 = XmlConvert.ToString(vInt32);
string s2 = Convert.ToString(vInt32);

s1 and s2 result in the same string.

so what is the added benefit ?

thnx
Chris
 
Chris said:
what is the purpose of XmlConvert.ToString() ?
why not just use Convert.ToString() ?

e.g.
Int32 vInt32 = -2147483648;
string s1 = XmlConvert.ToString(vInt32);
string s2 = Convert.ToString(vInt32);

s1 and s2 result in the same string.

so what is the added benefit ?

XmlConvert is guaranteed to use the appropriate format for XSD types.
For instance, a DateTime will always be formatted with
yyyy-MM-ddTHH:mm:ss as the format string, regardless of the culture.
 
Back
Top