共用方式為


SoapYear 類別

定義

包裝 XSD gYear 型別。

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

範例

下列程式代碼範例示範如何使用 SoapYear 類別來包裝 XSD gYear 類型。

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

int main()
{
   // Parse an XSD date to create a SoapYear object.
   String^ xsdDate = "2003";
   SoapYear^ date = SoapYear::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 SoapYear object.
   Console::WriteLine( "The XSD type of the SoapYear instance is {0}.",
      date->GetXsdType() );

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

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

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

public class Demo
{
    public static void Main(string[] args)
    {
        // Parse an XSD gYear to create a SoapYear object.
        // The time zone of this object is -08:00.
        string xsdYear = "2003-08:00";
        SoapYear year = SoapYear.Parse(xsdYear);

        // Print the year in XSD format. 
        Console.WriteLine("The year in XSD format is {0}.",
            year.ToString());

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

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

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

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

備註

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

建構函式

SoapYear()

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

SoapYear(DateTime)

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

SoapYear(DateTime, Int32)

使用指定的 SoapYear 物件和指出 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 轉換成 SoapYear 物件。

ToString()

傳回當做 ValueString

適用於