SoapDuration.Parse(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public:
static TimeSpan Parse(System::String ^ value);
public static TimeSpan Parse (string value);
static member Parse : string -> TimeSpan
Public Shared Function Parse (value As String) As TimeSpan
参数
返回
从 value
获取的 TimeSpan 对象。
例外
value
不包含与任何识别的格式模式相对应的日期和时间。
示例
下面的代码示例说明如何使用 Parse 方法。 此代码示例是为 SoapDuration 类提供的一个更大示例的一部分。
// Parse an XSD duration to create a TimeSpan object.
// This is a duration of 2 years, 3 months, 9 days, 12 hours,
// 35 minutes, 20 seconds, and 10 milliseconds.
String^ xsdDuration = L"P2Y3M9DT12H35M20.0100000S";
TimeSpan timeSpan = SoapDuration::Parse( xsdDuration );
Console::WriteLine( L"The time span contains {0} days.",
timeSpan.Days );
Console::WriteLine( L"The time span contains {0} hours.",
timeSpan.Hours );
Console::WriteLine( L"The time span contains {0} minutes.",
timeSpan.Minutes );
Console::WriteLine( L"The time span contains {0} seconds.",
timeSpan.Seconds );
// Parse an XSD duration to create a TimeSpan object.
// This is a duration of 2 years, 3 months, 9 days, 12 hours,
// 35 minutes, 20 seconds, and 10 milliseconds.
string xsdDuration = "P2Y3M9DT12H35M20.0100000S";
TimeSpan timeSpan = SoapDuration.Parse(xsdDuration);
Console.WriteLine("The time span contains {0} days.",
timeSpan.Days);
Console.WriteLine("The time span contains {0} hours.",
timeSpan.Hours);
Console.WriteLine("The time span contains {0} minutes.",
timeSpan.Minutes);
Console.WriteLine("The time span contains {0} seconds.",
timeSpan.Seconds);
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈