DataContractJsonSerializer 建構函式

定義

初始化 DataContractJsonSerializer 類別的新執行個體。Initializes a new instance of the DataContractJsonSerializer class.

多載

DataContractJsonSerializer(Type)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type.

DataContractJsonSerializer(Type, IEnumerable<Type>)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件,以及可能存在物件圖形中的已知型別集合。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type, with a collection of known types that may be present in the object graph.

DataContractJsonSerializer(Type, DataContractJsonSerializerSettings)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別及序列化程式設定的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type and serializer settings.

DataContractJsonSerializer(Type, String)

初始化 DataContractJsonSerializer 類別的新執行個體,使用參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter.

DataContractJsonSerializer(Type, XmlDictionaryString)

初始化 DataContractJsonSerializer 類別的新執行個體,使用 XmlDictionaryString 型別之參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter of type XmlDictionaryString.

DataContractJsonSerializer(Type, String, IEnumerable<Type>)

初始化 DataContractJsonSerializer 類別的新執行個體,使用參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件,以及可能存在物件圖形中的已知型別集合。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter, with a collection of known types that may be present in the object graph.

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>)

初始化 DataContractJsonSerializer 類別的新執行個體,使用 XmlDictionaryString 型別之參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件,以及可能存在物件圖形中的已知型別集合。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter of type XmlDictionaryString, with a collection of known types that may be present in the object graph.

DataContractJsonSerializer(Type, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 這個方法也會指定可能存在物件圖形中之已知型別的清單、要序列化或還原序列化之圖形項目的最大數、是否要忽略未預期資料或發出型別資訊,以及自訂序列化的 Surrogate。This method also specifies a list of known types that may be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate for custom serialization.

DataContractJsonSerializer(Type, String, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 這個方法也會指定 XML 項目的根名稱、可能存在物件圖形中之已知型別的清單、要序列化或還原序列化之圖形項目的最大數、是否要忽略未預期資料或發出型別資訊,以及自訂序列化的 Surrogate。This method also specifies the root name of the XML element, a list of known types that may be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate for custom serialization.

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 這個方法也會指定 XML 項目的根名稱、可能存在物件圖形中之已知型別的清單、要序列化或還原序列化之圖形項目的最大數、是否要忽略未預期資料或發出型別資訊,以及自訂序列化的 Surrogate。This method also specifies the root name of the XML element, a list of known types that may be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate for custom serialization.

DataContractJsonSerializer(Type)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type.

public:
 DataContractJsonSerializer(Type ^ type);
public DataContractJsonSerializer (Type type);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

適用於

DataContractJsonSerializer(Type, IEnumerable<Type>)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件,以及可能存在物件圖形中的已知型別集合。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type, with a collection of known types that may be present in the object graph.

public:
 DataContractJsonSerializer(Type ^ type, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractJsonSerializer (Type type, System.Collections.Generic.IEnumerable<Type> knownTypes);
public DataContractJsonSerializer (Type type, System.Collections.Generic.IEnumerable<Type>? knownTypes);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, knownTypes As IEnumerable(Of Type))

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that are serialized or deserialized.

knownTypes
IEnumerable<Type>

IEnumerable<T>Type,其中包含可能存在物件圖形中的型別。An IEnumerable<T> of Type that contains the types that may be present in the object graph.

適用於

DataContractJsonSerializer(Type, DataContractJsonSerializerSettings)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別及序列化程式設定的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type and serializer settings.

public:
 DataContractJsonSerializer(Type ^ type, System::Runtime::Serialization::Json::DataContractJsonSerializerSettings ^ settings);
public DataContractJsonSerializer (Type type, System.Runtime.Serialization.Json.DataContractJsonSerializerSettings settings);
public DataContractJsonSerializer (Type type, System.Runtime.Serialization.Json.DataContractJsonSerializerSettings? settings);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Runtime.Serialization.Json.DataContractJsonSerializerSettings -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, settings As DataContractJsonSerializerSettings)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

settings
DataContractJsonSerializerSettings

JSON 序列化程式的序列化程式設定。The serializer settings for the JSON serializer.

適用於

DataContractJsonSerializer(Type, String)

初始化 DataContractJsonSerializer 類別的新執行個體,使用參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter.

public:
 DataContractJsonSerializer(Type ^ type, System::String ^ rootName);
public DataContractJsonSerializer (Type type, string? rootName);
public DataContractJsonSerializer (Type type, string rootName);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As String)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

rootName
String

內含要序列化或還原序列化之內容的 XML 項目名稱。The name of the XML element that encloses the content to serialize or deserialize.

適用於

DataContractJsonSerializer(Type, XmlDictionaryString)

初始化 DataContractJsonSerializer 類別的新執行個體,使用 XmlDictionaryString 型別之參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter of type XmlDictionaryString.

public:
 DataContractJsonSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName);
public DataContractJsonSerializer (Type type, System.Xml.XmlDictionaryString? rootName);
public DataContractJsonSerializer (Type type, System.Xml.XmlDictionaryString rootName);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

rootName
XmlDictionaryString

XmlDictionaryString,其中包含內容的根項目名稱。An XmlDictionaryString that contains the root element name of the content.

適用於

DataContractJsonSerializer(Type, String, IEnumerable<Type>)

初始化 DataContractJsonSerializer 類別的新執行個體,使用參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件,以及可能存在物件圖形中的已知型別集合。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter, with a collection of known types that may be present in the object graph.

public:
 DataContractJsonSerializer(Type ^ type, System::String ^ rootName, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractJsonSerializer (Type type, string? rootName, System.Collections.Generic.IEnumerable<Type>? knownTypes);
public DataContractJsonSerializer (Type type, string rootName, System.Collections.Generic.IEnumerable<Type> knownTypes);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As String, knownTypes As IEnumerable(Of Type))

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

rootName
String

內含要序列化或還原序列化之內容的 XML 項目名稱。The name of the XML element that encloses the content to serialize or deserialize. 預設為 "root"。The default is "root".

knownTypes
IEnumerable<Type>

IEnumerable<T>Type,其中包含可能存在物件圖形中的型別。An IEnumerable<T> of Type that contains the types that may be present in the object graph.

適用於

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>)

初始化 DataContractJsonSerializer 類別的新執行個體,使用 XmlDictionaryString 型別之參數所指定的 XML 根項目來序列化或還原序列化指定型別的物件,以及可能存在物件圖形中的已知型別集合。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of a specified type using the XML root element specified by a parameter of type XmlDictionaryString, with a collection of known types that may be present in the object graph.

public:
 DataContractJsonSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractJsonSerializer (Type type, System.Xml.XmlDictionaryString? rootName, System.Collections.Generic.IEnumerable<Type>? knownTypes);
public DataContractJsonSerializer (Type type, System.Xml.XmlDictionaryString rootName, System.Collections.Generic.IEnumerable<Type> knownTypes);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString, knownTypes As IEnumerable(Of Type))

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

rootName
XmlDictionaryString

XmlDictionaryString,其中包含內容的根項目名稱。An XmlDictionaryString that contains the root element name of the content.

knownTypes
IEnumerable<Type>

IEnumerable<T>Type,其中包含可能存在物件圖形中的型別。An IEnumerable<T> of Type that contains the types that may be present in the object graph.

適用於

DataContractJsonSerializer(Type, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 這個方法也會指定可能存在物件圖形中之已知型別的清單、要序列化或還原序列化之圖形項目的最大數、是否要忽略未預期資料或發出型別資訊,以及自訂序列化的 Surrogate。This method also specifies a list of known types that may be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate for custom serialization.

public:
 DataContractJsonSerializer(Type ^ type, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate, bool alwaysEmitTypeInformation);
public DataContractJsonSerializer (Type type, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * seq<Type> * int * bool * System.Runtime.Serialization.IDataContractSurrogate * bool -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, dataContractSurrogate As IDataContractSurrogate, alwaysEmitTypeInformation As Boolean)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

knownTypes
IEnumerable<Type>

XmlDictionaryString,其中包含內容的根項目名稱。An XmlDictionaryString that contains the root element name of the content.

maxItemsInObjectGraph
Int32

IEnumerable<T>Type,其中包含可能存在物件圖形中的型別。An IEnumerable<T> of Type that contains the types that may be present in the object graph.

ignoreExtensionDataObject
Boolean

若要在序列化 (Serialization) 時忽略 true 介面,並在還原序列化 (Deserialization) 時忽略未預期的資料,則為 IExtensibleDataObject,否則為 falsetrue to ignore the IExtensibleDataObject interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. 預設為 falseThe default is false.

dataContractSurrogate
IDataContractSurrogate

IDataContractSurrogate 的實作,用來自訂序列化程序。An implementation of the IDataContractSurrogate to customize the serialization process.

alwaysEmitTypeInformation
Boolean

true 表示要發出型別資訊,否則為 falsetrue to emit type information; otherwise, false. 預設為 falseThe default is false.

適用於

DataContractJsonSerializer(Type, String, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 這個方法也會指定 XML 項目的根名稱、可能存在物件圖形中之已知型別的清單、要序列化或還原序列化之圖形項目的最大數、是否要忽略未預期資料或發出型別資訊,以及自訂序列化的 Surrogate。This method also specifies the root name of the XML element, a list of known types that may be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate for custom serialization.

public:
 DataContractJsonSerializer(Type ^ type, System::String ^ rootName, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate, bool alwaysEmitTypeInformation);
public DataContractJsonSerializer (Type type, string rootName, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string * seq<Type> * int * bool * System.Runtime.Serialization.IDataContractSurrogate * bool -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As String, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, dataContractSurrogate As IDataContractSurrogate, alwaysEmitTypeInformation As Boolean)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that is serialized or deserialized.

rootName
String

內含要序列化或還原序列化之內容的 XML 項目名稱。The name of the XML element that encloses the content to serialize or deserialize. 預設為 "root"。The default is "root".

knownTypes
IEnumerable<Type>

IEnumerable<T>Type,其中包含可能存在物件圖形中的型別。An IEnumerable<T> of Type that contains the types that may be present in the object graph.

maxItemsInObjectGraph
Int32

圖形中要序列化或還原序列化的最大項目數。The maximum number of items in the graph to serialize or deserialize. 預設為 MaxValue 屬性所傳回的值。The default is the value returned by the MaxValue property.

ignoreExtensionDataObject
Boolean

若要在序列化 (Serialization) 時忽略 true 介面,並在還原序列化 (Deserialization) 時忽略未預期的資料,則為 IExtensibleDataObject,否則為 falsetrue to ignore the IExtensibleDataObject interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. 預設為 falseThe default is false.

dataContractSurrogate
IDataContractSurrogate

IDataContractSurrogate 的實作,用來自訂序列化程序。An implementation of the IDataContractSurrogate to customize the serialization process.

alwaysEmitTypeInformation
Boolean

true 表示要發出型別資訊,否則為 falsetrue to emit type information; otherwise, false. 預設為 falseThe default is false.

適用於

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

初始化 DataContractJsonSerializer 類別的新執行個體,以序列化或還原序列化所指定型別的物件。Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 這個方法也會指定 XML 項目的根名稱、可能存在物件圖形中之已知型別的清單、要序列化或還原序列化之圖形項目的最大數、是否要忽略未預期資料或發出型別資訊,以及自訂序列化的 Surrogate。This method also specifies the root name of the XML element, a list of known types that may be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate for custom serialization.

public:
 DataContractJsonSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System::Runtime::Serialization::IDataContractSurrogate ^ dataContractSurrogate, bool alwaysEmitTypeInformation);
public DataContractJsonSerializer (Type type, System.Xml.XmlDictionaryString rootName, System.Collections.Generic.IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString * seq<Type> * int * bool * System.Runtime.Serialization.IDataContractSurrogate * bool -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As XmlDictionaryString, knownTypes As IEnumerable(Of Type), maxItemsInObjectGraph As Integer, ignoreExtensionDataObject As Boolean, dataContractSurrogate As IDataContractSurrogate, alwaysEmitTypeInformation As Boolean)

參數

type
Type

已序列化或還原序列化之執行個體的型別。The type of the instances that are serialized or deserialized.

rootName
XmlDictionaryString

XmlDictionaryString,其中包含內容的根項目名稱。An XmlDictionaryString that contains the root element name of the content.

knownTypes
IEnumerable<Type>

IEnumerable<T>Type,其中包含可能存在物件圖形中的已知型別。An IEnumerable<T> of Type that contains the known types that may be present in the object graph.

maxItemsInObjectGraph
Int32

圖形中要序列化或還原序列化的最大項目數。The maximum number of items in the graph to serialize or deserialize. 預設為 MaxValue 屬性所傳回的值。The default is the value returned by the MaxValue property.

ignoreExtensionDataObject
Boolean

若要在序列化 (Serialization) 時忽略 true 介面,並在還原序列化 (Deserialization) 時忽略未預期的資料,則為 IExtensibleDataObject,否則為 falsetrue to ignore the IExtensibleDataObject interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. 預設為 falseThe default is false.

dataContractSurrogate
IDataContractSurrogate

IDataContractSurrogate 的實作,用來自訂序列化程序。An implementation of the IDataContractSurrogate to customize the serialization process.

alwaysEmitTypeInformation
Boolean

true 表示要發出型別資訊,否則為 falsetrue to emit type information; otherwise, false. 預設為 falseThe default is false.

適用於