SoapDateTime 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供在 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) | |
ToString() |
返回表示当前对象的字符串。 (继承自 Object) |
ToString(DateTime) |
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈