System.Runtime.Serialization 命名空間

System.Runtime.Serialization 命名空間包含可用於序列化和還原序列化物件的類別。 The System.Runtime.Serialization namespace contains classes that can be used for serializing and deserializing objects. 序列化 (Serialization) 是將物件或物件圖形轉換為用於對其他位置進行儲存或傳輸之位元組線性序列的程序。 Serialization is the process of converting an object or a graph of objects into a linear sequence of bytes for either storage or transmission to another location. 還原序列化 (Deserialization) 是納入所儲存資訊並從其中重新建立物件的程序。 Deserialization is the process of taking in stored information and recreating objects from it.

類別

CollectionDataContractAttribute

當套用至集合型別時,就能夠自訂集合 Item 項目的規格。When applied to a collection type, enables custom specification of the collection item elements. 這個屬性只能套用至由 DataContractSerializer 識別為有效、可序列化集合的型別。This attribute can be applied only to types that are recognized by the DataContractSerializer as valid, serializable collections.

ContractNamespaceAttribute

指定資料合約的 CLR 命名空間和 XML 命名空間。Specifies the CLR namespace and XML namespace of the data contract.

DataContractAttribute

指定定義或實作資料合約的型別,可由序列化程式 (例如 DataContractSerializer) 加以序列化。Specifies that the type defines or implements a data contract and is serializable by a serializer, such as the DataContractSerializer. 型別作者一定要定義型別的資料合約,才能讓型別能夠進行序列化。To make their type serializable, type authors must define a data contract for their type.

DataContractResolver

提供在序列化及還原序列化期間,以動態方式來回對應型別與 xsi:type 表示的機制。Provides a mechanism for dynamically mapping types to and from xsi:type representations during serialization and deserialization.

DataContractSerializer

將某個型別的執行個體序列化及還原序列化成使用所提供資料合約的 XML 資料流或文件。Serializes and deserializes an instance of a type into an XML stream or document using a supplied data contract. 這個類別無法被繼承。This class cannot be inherited.

DataContractSerializerExtensions

提供設定和取得 ISerializationSurrogateProvider 的方法,以擴充 DataContractSerializer 類別。Extends the DataContractSerializer class by providing methods for setting and getting an ISerializationSurrogateProvider.

DataContractSerializerSettings

指定資料合約序列化程式設定。Specifies data contract serializer settings.

DataMemberAttribute

當套用至型別的成員時,便會指定該成員屬於資料合約的一部分,而且已由 DataContractSerializer 完成序列化。When applied to the member of a type, specifies that the member is part of a data contract and is serializable by the DataContractSerializer.

DateTimeFormat

指定日期時間格式選項。Specifies date-time format options.

EnumMemberAttribute

指定欄位是列舉成員,並且應該加以序列化。Specifies that the field is an enumeration member and should be serialized.

ExportOptions

表示 XsdDataContractExporter 可以設定的選項。Represents the options that can be set for an XsdDataContractExporter.

ExtensionDataObject

儲存已建立版本之資料合約的資料,此資料合約已因加入新成員而得到擴充。Stores data from a versioned data contract that has been extended by adding new members.

Formatter

將基本功能提供給 Common Language Runtime 序列化格式子 (Serialization Formatter)。Provides base functionality for the common language runtime serialization formatters.

FormatterConverter

表示 IFormatterConverter 介面的基底實作,該介面使用 Convert 類別和 IConvertible 介面。Represents a base implementation of the IFormatterConverter interface that uses the Convert class and the IConvertible interface.

FormatterServices

提供靜態方法,協助序列化 (Serialization) Formatter 的實作。Provides static methods to aid with the implementation of a Formatter for serialization. 這個類別無法被繼承。This class cannot be inherited.

IgnoreDataMemberAttribute

當套用至型別的成員時,會指定該成員不屬於資料合約的一部分,而且未序列化。When applied to the member of a type, specifies that the member is not part of a data contract and is not serialized.

ImportOptions

表示可以在 XsdDataContractImporter 上設定的選項。Represents the options that can be set on an XsdDataContractImporter.

InvalidDataContractException

DataContractSerializerNetDataContractSerializer 在序列化 (Serialization) 和還原序列化 (Deserialization) 期間遇到無效的資料合約時,所擲回的例外狀況。The exception that is thrown when the DataContractSerializer or NetDataContractSerializer encounters an invalid data contract during serialization and deserialization.

KnownTypeAttribute

指定在序列化或還原序列化指定型別時,應該要由 DataContractSerializer 辨識的型別。Specifies types that should be recognized by the DataContractSerializer when serializing or deserializing a given type.

NetDataContractSerializer

將某個類型的執行個體序列化及還原序列化成使用所提供 .NET Framework 類型的 XML 資料流或文件。Serializes and deserializes an instance of a type into XML stream or document using the supplied .NET Framework types. 這個類別無法被繼承。This class cannot be inherited.

ObjectIDGenerator

產生物件的 ID。Generates IDs for objects.

ObjectManager

在物件還原序列化時保持追蹤。Keeps track of objects as they are deserialized.

OnDeserializedAttribute

套用至方法時,指定在還原序列化物件圖形中的物件後立即呼叫該方法。When applied to a method, specifies that the method is called immediately after deserialization of an object in an object graph. 還原序列化相對於圖形中其他物件的順序不具決定性。The order of deserialization relative to other objects in the graph is non-deterministic.

OnDeserializingAttribute

套用至方法時,指定在還原序列化物件圖形中的物件期間呼叫該方法。When applied to a method, specifies that the method is called during deserialization of an object in an object graph. 還原序列化相對於圖形中其他物件的順序不具決定性。The order of deserialization relative to other objects in the graph is non-deterministic.

OnSerializedAttribute

套用至方法時,指定在還原序列化物件圖形中的物件後呼叫該方法。When applied to a method, specifies that the method is called after serialization of an object in an object graph. 序列化相對於圖形中其他物件的順序不具決定性。The order of serialization relative to other objects in the graph is non-deterministic.

OnSerializingAttribute

套用至方法時,指定在還原序列化物件圖形中的物件期間呼叫該方法。When applied to a method, specifies that the method is during serialization of an object in an object graph. 序列化相對於圖形中其他物件的順序不具決定性。The order of serialization relative to other objects in the graph is non-deterministic.

OptionalFieldAttribute

指定可從序列化 (Serialization) 資料流中遺漏欄位,使 BinaryFormatterSoapFormatter 不會擲回例外狀況。Specifies that a field can be missing from a serialization stream so that the BinaryFormatter and the SoapFormatter does not throw an exception.

SafeSerializationEventArgs

提供 SerializeObjectState 事件的資料。Provides data for the SerializeObjectState event.

SerializationBinder

允許使用者控制類別的載入,並且託管要載入的類別。Allows users to control class loading and mandate what class to load.

SerializationException

當序列化 (Serialization) 或還原序列化 (Deserialization) 期間發生錯誤時,擲回的例外狀況。The exception thrown when an error occurs during serialization or deserialization.

SerializationInfo

儲存序列化或還原序列化物件所需的所有資料。Stores all the data needed to serialize or deserialize an object. 這個類別無法被繼承。This class cannot be inherited.

SerializationInfoEnumerator

針對解析 SerializationInfo 中的資料,提供易用的格式子 (Formatter) 機制。Provides a formatter-friendly mechanism for parsing the data in SerializationInfo. 這個類別無法被繼承。This class cannot be inherited.

SerializationObjectManager

在執行階段管理序列化處理序。Manages serialization processes at run time. 這個類別無法被繼承。This class cannot be inherited.

SurrogateSelector

在序列化 (Serialization) 代理的選取方面協助格式子 (Formatter),以委派 (Delegate) 序列化或還原序列化 (Deserialization) 處理序。Assists formatters in selection of the serialization surrogate to delegate the serialization or deserialization process to.

XmlObjectSerializer

提供用來將物件序列化為 XML 資料流或文件的基底類別。Provides the base class used to serialize objects as XML streams or documents. 這個類別是抽象的。This class is abstract.

XmlSerializableServices

包含讀取和寫入 XML 的方法。Contains methods for reading and writing XML.

XPathQueryGenerator

當提供代表資料合約的類別,以及代表合約成員的中繼資料時,會產生該成員的 XPath 查詢。When given a class representing a data contract, and metadata representing a member of the contract, produces an XPath query for the member.

XsdDataContractExporter

允許將資料合約中使用的 .NET Framework 類型集合轉換成 XML 結構描述檔案 (.xsd)。Allows the transformation of a set of .NET Framework types that are used in data contracts into an XML schema file (.xsd).

XsdDataContractImporter

允許將 XML 結構描述檔案 (.xsd) 集合轉換為 Common Language Runtime (CLR) 型別。Allows the transformation of a set of XML schema files (.xsd) into common language runtime (CLR) types.

結構

SerializationEntry

存留該值、Type 和已序列化物件的名稱。Holds the value, Type, and name of a serialized object.

StreamingContext

描述指定之序列化資料流的來源和目的端,並提供額外的呼叫端定義內容。Describes the source and destination of a given serialized stream, and provides an additional caller-defined context.

介面

IDataContractSurrogate

提供 DataContractSerializer 在序列化 (Serialization)、還原序列化 (Deserialization),以及匯出和匯入 XML 結構描述文件 (XSD) 期間,必須用來將型別取代成另一種型別的方法。Provides the methods needed to substitute one type for another by the DataContractSerializer during serialization, deserialization, and export and import of XML schema documents (XSD).

IDeserializationCallback

指示在整個物件 Graph 的還原序列化 (Deserialization) 完成時告知類別。Indicates that a class is to be notified when deserialization of the entire object graph has been completed. 請注意,使用 XmlSerializer (System.Xml.Serialization.XmlSerializer) 還原序列化時,不會呼叫這個介面。Note that this interface is not called when deserializing with the XmlSerializer (System.Xml.Serialization.XmlSerializer).

IExtensibleDataObject

提供資料結構,以便儲存 XmlObjectSerializer 在還原序列化標記有 DataContractAttribute 屬性的型別時所遇到的額外資料。Provides a data structure to store extra data encountered by the XmlObjectSerializer during deserialization of a type marked with the DataContractAttribute attribute.

IFormatter

提供用於格式化已序列化物件的功能。Provides functionality for formatting serialized objects.

IFormatterConverter

提供 SerializationInfo 執行個體 (Instance) 和格式子提供類別之間的連接,最適用於在 SerializationInfo 中剖析資料。Provides the connection between an instance of SerializationInfo and the formatter-provided class best suited to parse the data inside the SerializationInfo.

IObjectReference

指示目前的介面實作器是對其他物件的參考。Indicates that the current interface implementer is a reference to another object.

ISafeSerializationData

在安全性透明程式碼中啟用自訂例外狀況資料序列化。Enables serialization of custom exception data in security-transparent code.

ISerializable

允許物件控制它自己的序列化 (Serialization) 和還原序列化 (Deserialization)。Allows an object to control its own serialization and deserialization.

ISerializationSurrogate

實作允許一個物件執行另一個物件序列化 (Serialization) 和還原序列化 (Deserialization) 的序列化代理選取器。Implements a serialization surrogate selector that allows one object to perform serialization and deserialization of another.

ISerializationSurrogateProvider

提供建構擴充 DataContractSerializer 的序列化代理所需之方法。Provides the methods needed to construct a serialization surrogate that extends the DataContractSerializer. 在序列化及還原序列化期間,會使用序列化代理將類型替代為其他類型。A serialization surrogate is used during serialization and deserialization to substitute one type for another.

ISurrogateSelector

指示序列化 (Serialization) 代理選取器類別。Indicates a serialization surrogate selector class.

列舉

EmitTypeInformation

指定發出型別資訊的頻率。Specifies how often to emit type information.

StreamingContextStates

定義一組旗標,指定序列化期間資料流的來源或目的內容。Defines a set of flags that specifies the source or destination context for the stream during serialization.

備註

ISerializable 介面會提供方法,讓類別控制它們自己的序列化行為。The ISerializable interface provides a way for classes to control their own serialization behavior. 中的類別System.Runtime.Serialization.Formatters命名空間可讓您控制序列化的物件中封裝的各種資料類型的實際格式。Classes in the System.Runtime.Serialization.Formatters namespace control the actual formatting of various data types encapsulated in the serialized objects.

序列化和還原序列化物件與特定格式的格式器,可在System.Runtime.Serialization.Formatters命名空間。Formatters that serialize and deserialize objects to and from a particular format can be found in the System.Runtime.Serialization.Formatters namespace.