다음을 통해 공유


SoapDuration.ToString(TimeSpan) 메서드

정의

지정된 TimeSpan 개체를 String으로 반환합니다.

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

매개 변수

timeSpan
TimeSpan

변환할 TimeSpan 개체입니다.

반환

timeSpan을 "PxxYxxDTxxHxxMxx.xxxS" 또는 "PxxYxxDTxxHxxMxxS" 형식으로 표현하는 String입니다. Milliseconds가 0이 아니면 "PxxYxxDTxxHxxMxx.xxxS"가 사용됩니다.

예제

다음 코드 예제에서는 ToString 메서드를 사용하는 방법을 보여 줍니다. 이 코드 예제는 제공 된 큰 예제의 일부는 SoapDuration 클래스입니다.

// 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));

적용 대상