SoapDateTime 类

定义

提供在 DateTime 与 XSD dateTime 格式的字符串之间进行序列化和反序列化的静态方法。

public ref class SoapDateTime sealed
public sealed class SoapDateTime
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SoapDateTime
type SoapDateTime = class
[<System.Runtime.InteropServices.ComVisible(true)>]
type SoapDateTime = class
Public NotInheritable Class SoapDateTime
继承
SoapDateTime
属性

示例

下面的代码示例演示如何使用 类中SoapDateTime的方法在 对象和 XSD dateTime 字符串之间DateTime转换。

using namespace System;
using namespace System::Runtime::Remoting::Metadata::W3cXsd2001;
int main()
{
   
   // Parse an XSD dateTime to create a DateTime object.
   String^ xsdDateTime = "2003-02-04T13:58:59.9999999+03:00";
   DateTime dateTime = SoapDateTime::Parse( xsdDateTime );
   
   // Serialize a DateTime object as an XSD dateTime string.
   Console::WriteLine( "The date in XSD format is {0}.", SoapDateTime::ToString( dateTime ) );
   
   // Print out the XSD type string of the SoapDateTime class.
   Console::WriteLine( "The XSD type of SoapDateTime is {0}.", SoapDateTime::XsdType );
   
}
using System;
using System.Runtime.Remoting.Metadata.W3cXsd2001;

public class Demo
{
    public static void Main(string[] args)
    {
        // Parse an XSD dateTime to create a DateTime object.
        string xsdDateTime = "2003-02-04T13:58:59.9999999+03:00";
        DateTime dateTime = SoapDateTime.Parse(xsdDateTime);

        // Serialize a DateTime object as an XSD dateTime string.
        Console.WriteLine("The date in XSD format is {0}.",
            SoapDateTime.ToString(dateTime));

        // Print the XSD type string of the SoapDateTime class.
        Console.WriteLine("The XSD type of SoapDateTime is {0}.",
            SoapDateTime.XsdType);
    }
}

注解

有关 XSD 数据类型的详细信息,请参阅 XML 数据类型参考

构造函数

SoapDateTime()

创建 SoapDateTime 的实例。

属性

XsdType

获取当前 SOAP 类型的 XML 架构定义语言 (XSD)。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
Parse(String)

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

ToString()

返回表示当前对象的字符串。

(继承自 Object)
ToString(DateTime)

DateTime 的形式返回指定的 String 对象。

适用于