DateTimeSerializationSection.DateTimeSerializationMode 列舉

定義

判斷 DateTime 物件的 XML 序列化格式。Determines XML serialization format of DateTime objects.

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

public: enum class DateTimeSerializationSection::DateTimeSerializationMode
public enum DateTimeSerializationSection.DateTimeSerializationMode
type DateTimeSerializationSection.DateTimeSerializationMode = 
Public Enum DateTimeSerializationSection.DateTimeSerializationMode
繼承
DateTimeSerializationSection.DateTimeSerializationMode

欄位

Default 0

Roundtrip 相同。Same as Roundtrip.

Local 2

序列化程式會將所有 DateTime 物件格式化為本地時間。The serializer formats all DateTime objects as local time. 這適用於版本 1.0 和 1.1 的相容性。This is for version 1.0 and 1.1 compatibility.

Roundtrip 1

序列化程式會檢查個別的 DateTime 執行個體,以判斷序列化格式︰UTC、本機或未指定。The serializer examines individual DateTime instances to determine the serialization format: UTC, local, or unspecified.

備註

此列舉僅供序列化基礎結構使用,而非供公開使用。This enumeration is used by the serialization infrastructure only, and is not intended for public use. 若要實際設定序列化模式,請建立應用程式佈建檔,並將<dateTimeSerialization> 元素設定為適當的設定。To actually set the serialization mode, create an application configuration file, and set the <dateTimeSerialization> Element to an appropriate setting. 如需組態檔的詳細資訊,請參閱組態檔結構描述For more information about configuration files, see Configuration File Schema.

在 .NET Framework 的版本1.0 和1.1 中,以及2.0 和更新版本中,當這個屬性設定為 Local時,DateTime 物件一律會格式化為本地時間。In versions 1.0 and 1.1 of .NET Framework, as well as in versions 2.0 and later 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.

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

適用於

另請參閱