SoapYearMonth.Parse(String) 方法

定义

将指定的 String 转换为 SoapYearMonth 对象。

public:
 static System::Runtime::Remoting::Metadata::W3cXsd2001::SoapYearMonth ^ Parse(System::String ^ value);
public static System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth Parse (string value);
static member Parse : string -> System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth
Public Shared Function Parse (value As String) As SoapYearMonth

参数

value
String

要转换的 String

返回

value 获取的 SoapYearMonth 对象。

例外

value 不包含与任何识别的格式模式相对应的日期和时间。

示例

下面的代码示例演示如何使用此方法。 此代码示例是为 SoapYearMonth 类提供的一个更大示例的一部分。

// Parse an XSD gYearMonth to create a SoapYearMonth object.
// The timezone of this object is -08:00.
String^ xsdYearMonth = "2003-11-08:00";
SoapYearMonth^ yearMonth = SoapYearMonth::Parse( xsdYearMonth );
// Parse an XSD gYearMonth to create a SoapYearMonth object.
// The time zone of this object is -08:00.
string xsdYearMonth = "2003-11-08:00";
SoapYearMonth yearMonth = SoapYearMonth.Parse(xsdYearMonth);

注解

方法 Parse 能够分析各种格式的字符串。 可识别的字符串格式由以下格式模式组成。

格式模式 说明 示例
yyyy 采用 4 位数格式的年份。 1999, 1812
MM 数字月份。 个位数月份有前导零。 11, 05
zzz 与格林威治平均时间) (世界时坐标) 的完整时区偏移量 (小时和分钟。 一位数小时具有前导零。 -07:00, 08:00

适用于