SoapDuration.ToString(TimeSpan) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
static System::String ^ ToString(TimeSpan timeSpan);
public static string ToString (TimeSpan timeSpan);
static member ToString : TimeSpan -> string
Public Shared Function ToString (timeSpan As TimeSpan) As String
Parameters
Returns
A String representation of timeSpan
in the format "PxxYxxDTxxHxxMxx.xxxS" or "PxxYxxDTxxHxxMxxS". The "PxxYxxDTxxHxxMxx.xxxS" is used if Milliseconds does not equal zero.
Examples
The following code example shows how to use the ToString method. This code example is part of a larger example that is provided for the SoapDuration class.
// Serialize a TimeSpan object as an XSD duration string.
// This object represents a time span of 399 days, 12 hours,
// 35 minutes, 20 seconds, and 10 milliseconds.
TimeSpan duration = TimeSpan(399,12,35,20,10);
Console::WriteLine( L"The duration in XSD format is {0}.",
SoapDuration::ToString( duration ) );
// Serialize a TimeSpan object as an XSD duration string.
// This object represents a time span of 399 days, 12 hours,
// 35 minutes, 20 seconds, and 10 milliseconds.
TimeSpan duration = new TimeSpan(399, 12, 35, 20, 10);
Console.WriteLine("The duration in XSD format is {0}.",
SoapDuration.ToString(duration));
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.