共用方式為


SoapDate 類別

定義

包裝 XSD date 型別。

public ref class SoapDate sealed : System::Runtime::Remoting::Metadata::W3cXsd2001::ISoapXsd
[System.Serializable]
public sealed class SoapDate : System.Runtime.Remoting.Metadata.W3cXsd2001.ISoapXsd
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SoapDate : System.Runtime.Remoting.Metadata.W3cXsd2001.ISoapXsd
[<System.Serializable>]
type SoapDate = class
    interface ISoapXsd
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SoapDate = class
    interface ISoapXsd
Public NotInheritable Class SoapDate
Implements ISoapXsd
繼承
SoapDate
屬性
實作

範例

下列程式代碼範例示範如何使用 SoapDate 類別來包裝 XML date 類型。

using namespace System;
using namespace System::Runtime::Remoting::Metadata::W3cXsd2001;

int main()
{
   // Parse an XSD date to create a SoapDate object.
   String^ xsdDate = "2003-02-04";
   SoapDate^ date = SoapDate::Parse( xsdDate );

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

   // Print out the XSD type string of this particular SoapDate object.
   Console::WriteLine( "The XSD type of the SoapDate instance is {0}.",
      date->GetXsdType() );

   // Print out the value of the SoapDate object.
   Console::WriteLine( "The value of the SoapDate instance is {0}.",
      date->Value );

   // Print out the sign of the SoapDate object.
   Console::WriteLine( "The sign of the SoapDate instance is {0}.",
      date->Sign );

   // Print out the XSD type string of the SoapDate class.
   Console::WriteLine( "The XSD type of SoapDate is {0}.",
      SoapDate::XsdType );
}
using System;
using System.Runtime.Remoting.Metadata.W3cXsd2001;

public class Demo
{
    public static void Main(string[] args)
    {
        // Parse an XSD date to create a SoapDate object.
        string xsdDate = "2003-02-04";
        SoapDate date = SoapDate.Parse(xsdDate);

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

        // Print the XSD type string of this particular SoapDate object.
        Console.WriteLine("The XSD type of the SoapDate object is {0}.",
            date.GetXsdType());

        // Print the value of the SoapDate object.
        Console.WriteLine("The value of the SoapDate object is {0}.",
            date.Value);

        // Print the sign of the SoapDate object.
        Console.WriteLine("The sign of the SoapDate object is {0}.",
            date.Sign);

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

備註

如需 XSD 資料類型的詳細資訊,請參閱 XML 數據類型參考

建構函式

SoapDate()

初始化 SoapDate 類別的新執行個體。

SoapDate(DateTime)

使用指定的 SoapDate 物件,初始化 DateTime 類別的新執行個體。

SoapDate(DateTime, Int32)

使用指定的 SoapDate 物件和指出 DateTime 是正值還是負值的整數,初始化 Value 類別的新執行個體。

屬性

Sign

取得或設定目前執行個體的日期和時間為正數或負數。

Value

取得或設定目前執行個體的日期和時間。

XsdType

取得目前 SOAP 型別的 XML 結構描述定義語言 (XSD)。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetXsdType()

傳回目前 SOAP 型別的 XML 結構描述定義語言 (XSD)。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Parse(String)

將指定的 String 轉換成 SoapDate 物件。

ToString()

傳回當做 ValueString

適用於