<dateTimeSerialization > 項目<dateTimeSerialization> Element

判斷 DateTime 物件的序列化模式。Determines the serialization mode of DateTime objects.

<configuration><configuration>
<dateTimeSerialization><dateTimeSerialization>

語法Syntax

<dateTimeSerialization  
    mode = "Roundtrip" | "Local"  
/>  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.

屬性Attributes

屬性Attributes 描述Description
mode 選擇性。Optional. 指定序列化模式。Specifies the serialization mode. 設定為其中一個 DateTimeSerializationSection.DateTimeSerializationMode 值。Set to one of the DateTimeSerializationSection.DateTimeSerializationMode values. 預設值為 RoundTripThe default is RoundTrip.

子元素Child Elements

無。None.

父項目Parent Elements

項目Element 描述Description
system.xml.serializationsystem.xml.serialization 用來控制 XML 序列化的最上層項目。The top-level element for controlling XML serialization.

備註Remarks

在 .NET Framework 的 1.0、1.1 和 2.0 版以及更新版本中,將此屬性設定為 Local 時,DateTime 物件一定會格式化為當地時間。In versions 1.0, 1.1, 2.0 and later versions of the .NET Framework, when this property is set to Local, DateTime objects are always formatted as the local time. 也就是說,本地時區資訊一定會包含在序列化資料中。That is, local time zone information is always included with the serialized data. 將此屬性設定為 Local,確保與舊版 .NET Framework 的相容性。Set this property to Local to ensure compatibility with older versions of the .NET Framework.

在將此屬性設定為 Roundtrip 的 .NET Framework 2.0 版及更新版本中,會檢查 DateTime 物件以判斷其位於當地時區、UTC 或非特定時區。In version 2.0 and later versions of the .NET Framework that have this property set to Roundtrip, DateTime objects are examined to determine whether they are in the local, UTC, or an unspecified time zone. 然後 DateTime 物件會以保留此資訊的方式序列化。The DateTime objects are then serialized in such a way that this information is preserved. 這是預設行為,並建議所有新的應用程式不要與舊版 Framework 進行通訊。This is the default behavior and is the recommended behavior for all new applications that do not communicate with older versions of the framework.

另請參閱See also