Partager via


SoapDate Classe

Définition

Inclut dans un wrapper un type date XSD.

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
Héritage
SoapDate
Attributs
Implémente

Exemples

L’exemple de code suivant illustre l’utilisation de la SoapDate classe pour encapsuler un type 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);
    }
}

Remarques

Pour plus d’informations sur les types de données XSD, consultez la référence sur les types de données XML.

Constructeurs

SoapDate()

Initialise une nouvelle instance de la classe SoapDate.

SoapDate(DateTime)

Initialise une nouvelle instance de la classe SoapDate avec un objet DateTime spécifié.

SoapDate(DateTime, Int32)

Initialise une nouvelle instance de la classe SoapDate avec un objet DateTime spécifié et un entier indiquant si Value est une valeur positive ou négative.

Propriétés

Sign

Obtient ou définit une valeur indiquant si la date et l'heure de l'instance actuelle sont positives ou négatives.

Value

Obtient ou définit la date et l'heure de l'instance actuelle.

XsdType

Obtient le langage XSD (XML Schema Definition) du type SOAP en cours.

Méthodes

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
GetXsdType()

Retourne le langage XSD (XML Schema Definition) du type SOAP en cours.

MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
Parse(String)

Convertit le String spécifié en un objet SoapDate.

ToString()

Retourne une Value comme String.

S’applique à