SoapDateTime 类
定义
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 DateTime 对象和 XSD 字符串之间进行转换 dateTime 。The following code example shows how to use the methods in the SoapDateTime class to convert between a DateTime object and an XSD dateTime string.
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 数据类型参考。For more information about XSD data types, see the XML Data Types Reference.
构造函数
| SoapDateTime() |
创建 SoapDateTime 的实例。Creates an instance of SoapDateTime. |
属性
| XsdType |
获取当前 SOAP 类型的 XML 架构定义语言 (XSD)。Gets the XML Schema definition language (XSD) of the current SOAP type. |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| Parse(String) |
将指定的 String 转换为 DateTime 对象。Converts the specified String into a DateTime object. |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |
| ToString(DateTime) |
以 DateTime 的形式返回指定的 String 对象。Returns the specified DateTime object as a String. |