Converting .NET Framework Types to Strings

If you want to convert a .NET Framework type to a string, use the ToString method. The ToString method returns a string representation of the type passed in. The following table lists the .NET Framework types that return a string in a format that maps to the XML Schema (XSD) specifications.

.NET Framework type String type returned
Boolean "true", "false"
Single.PositiveInfinity "INF"
Single.NegativeInfinity "-INF"
Double.PositiveInfinity "INF"
Double.NegativeInfinity "-INF"
DateTime Format is yyyy-MM-ddTHH:mm:ss, for example, 2001-08-04T02:20:00 is the year 2001, the month is August, the day is the 4th, and the time is 2am, 20 minutes, zero seconds.
Timespan Format is PnYnMnTnHnMnS, for example, P2Y10M15DT10H30M20S is a duration of 2 years, 10 months, 15 days, 10hours, 30 minutes and 20 seconds.

See Also

Conversion of XML Data Types | Converting Strings to .NET Framework Data Types