DataContractJsonSerializer 建構函式

定義

初始化 DataContractJsonSerializer 類別的新執行個體。

多載

名稱 Description
DataContractJsonSerializer(Type)

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。

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

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。 此方法同時指定 XML 元素的根名稱、物件圖中可能存在的已知類型清單、可序列化或反序列化的最大圖項目數、是否忽略意外資料或輸出類型資訊,以及自訂序列化的替代工具。

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

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。 此方法同時指定物件圖中可能存在的已知類型清單、可序列化或反序列化的最大圖項目數、是否忽略意外資料或發出類型資訊,以及自訂序列化的代理。

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>)

初始化該類別的新實例 DataContractJsonSerializer ,利用由型別 XmlDictionaryString為 的參數指定的 XML 根元素,序列化或反序列化指定類型的物件,並包含物件圖中可能存在的已知類型集合。

DataContractJsonSerializer(Type, String, IEnumerable<Type>)

初始化該類別的新實例 DataContractJsonSerializer ,使用由參數指定的 XML 根元素,並包含物件圖中可能存在的已知型別,來序列化或反序列化指定類型的物件。

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

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。 此方法同時指定 XML 元素的根名稱、物件圖中可能存在的已知類型清單、可序列化或反序列化的最大圖項目數、是否忽略意外資料或輸出類型資訊,以及自訂序列化的替代工具。

DataContractJsonSerializer(Type, String)

初始化該類別的新實例 DataContractJsonSerializer ,利用參數指定的 XML 根元素序列化或反序列化指定型別的物件。

DataContractJsonSerializer(Type, DataContractJsonSerializerSettings)

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型及序列化器設定的物件。

DataContractJsonSerializer(Type, IEnumerable<Type>)

初始化類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件,並包含物件圖中可能存在的已知類型集合。

DataContractJsonSerializer(Type, XmlDictionaryString)

初始化該類別的新實例 DataContractJsonSerializer ,以使用由型別 XmlDictionaryString為 的參數指定的 XML 根元素,序列化或反序列化指定型態的物件。

DataContractJsonSerializer(Type)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。

public:
 DataContractJsonSerializer(Type ^ type);
public DataContractJsonSerializer(Type type);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type)

參數

type
Type

是序列化或非序列化的實例類型。

屬性

適用於

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

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。 此方法同時指定 XML 元素的根名稱、物件圖中可能存在的已知類型清單、可序列化或反序列化的最大圖項目數、是否忽略意外資料或輸出類型資訊,以及自訂序列化的替代工具。

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

序列化或非序列化的實例類型。

rootName
XmlDictionaryString

一個 XmlDictionaryString 包含內容根元素名稱的 that。

knownTypes
IEnumerable<Type>

其中 an IEnumerable<T>Type 包含物件圖中可能存在的已知類型。

maxItemsInObjectGraph
Int32

圖中最多可序列化或反序列化的項目數量。 預設值是 Int32.MaxValue 屬性回傳的值。

ignoreExtensionDataObject
Boolean

true 序列化時忽略 IExtensibleDataObject 介面,反序列化時忽略意外資料;否則, false。 預設值為 false

dataContractSurrogate
IDataContractSurrogate

一個用於自訂序列化流程的實作 IDataContractSurrogate

alwaysEmitTypeInformation
Boolean

true以發送類型資訊;否則,。 false 預設值為 false

適用於

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

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。 此方法同時指定物件圖中可能存在的已知類型清單、可序列化或反序列化的最大圖項目數、是否忽略意外資料或發出類型資訊,以及自訂序列化的代理。

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

是序列化或非序列化的實例類型。

knownTypes
IEnumerable<Type>

一個 XmlDictionaryString 包含內容根元素名稱的 that。

maxItemsInObjectGraph
Int32

其中 a IEnumerable<T>Type 包含了可能存在於物件圖中的類型。

ignoreExtensionDataObject
Boolean

true 序列化時忽略 IExtensibleDataObject 介面,反序列化時忽略意外資料;否則, false。 預設值為 false

dataContractSurrogate
IDataContractSurrogate

一個用於自訂序列化流程的實作 IDataContractSurrogate

alwaysEmitTypeInformation
Boolean

true以發送類型資訊;否則,。 false 預設值為 false

適用於

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化該類別的新實例 DataContractJsonSerializer ,利用由型別 XmlDictionaryString為 的參數指定的 XML 根元素,序列化或反序列化指定類型的物件,並包含物件圖中可能存在的已知類型集合。

public:
 DataContractJsonSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
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

是序列化或非序列化的實例類型。

rootName
XmlDictionaryString

一個 XmlDictionaryString 包含內容根元素名稱的 that。

knownTypes
IEnumerable<Type>

其中 a IEnumerable<T>Type 包含了可能存在於物件圖中的類型。

屬性

適用於

DataContractJsonSerializer(Type, String, IEnumerable<Type>)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化該類別的新實例 DataContractJsonSerializer ,使用由參數指定的 XML 根元素,並包含物件圖中可能存在的已知型別,來序列化或反序列化指定類型的物件。

public:
 DataContractJsonSerializer(Type ^ type, System::String ^ rootName, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, string? rootName, System.Collections.Generic.IEnumerable<Type>? knownTypes);
public DataContractJsonSerializer(Type type, string? rootName, System.Collections.Generic.IEnumerable<Type>? knownTypes);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, string? rootName, System.Collections.Generic.IEnumerable<Type>? knownTypes);
public DataContractJsonSerializer(Type type, string rootName, System.Collections.Generic.IEnumerable<Type> knownTypes);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
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

是序列化或非序列化的實例類型。

rootName
String

包覆內容以進行序列化或反序列化的 XML 元素名稱。 預設是「root」。

knownTypes
IEnumerable<Type>

其中 a IEnumerable<T>Type 包含了可能存在於物件圖中的類型。

屬性

適用於

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

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件。 此方法同時指定 XML 元素的根名稱、物件圖中可能存在的已知類型清單、可序列化或反序列化的最大圖項目數、是否忽略意外資料或輸出類型資訊,以及自訂序列化的替代工具。

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

是序列化或非序列化的實例類型。

rootName
String

包覆內容以進行序列化或反序列化的 XML 元素名稱。 預設是「root」。

knownTypes
IEnumerable<Type>

其中 a IEnumerable<T>Type 包含了可能存在於物件圖中的類型。

maxItemsInObjectGraph
Int32

圖中最多可序列化或反序列化的項目數量。 預設值是 Int32.MaxValue 屬性回傳的值。

ignoreExtensionDataObject
Boolean

true 序列化時忽略 IExtensibleDataObject 介面,反序列化時忽略意外資料;否則, false。 預設值為 false

dataContractSurrogate
IDataContractSurrogate

一個用於自訂序列化流程的實作 IDataContractSurrogate

alwaysEmitTypeInformation
Boolean

true以發送類型資訊;否則,。 false 預設值為 false

適用於

DataContractJsonSerializer(Type, String)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化該類別的新實例 DataContractJsonSerializer ,利用參數指定的 XML 根元素序列化或反序列化指定型別的物件。

public:
 DataContractJsonSerializer(Type ^ type, System::String ^ rootName);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, string? rootName);
public DataContractJsonSerializer(Type type, string? rootName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, string? rootName);
public DataContractJsonSerializer(Type type, string rootName);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string -> System.Runtime.Serialization.Json.DataContractJsonSerializer
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * string -> System.Runtime.Serialization.Json.DataContractJsonSerializer
Public Sub New (type As Type, rootName As String)

參數

type
Type

是序列化或非序列化的實例類型。

rootName
String

包覆內容以進行序列化或反序列化的 XML 元素名稱。

屬性

適用於

DataContractJsonSerializer(Type, DataContractJsonSerializerSettings)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化該類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型及序列化器設定的物件。

public:
 DataContractJsonSerializer(Type ^ type, System::Runtime::Serialization::Json::DataContractJsonSerializerSettings ^ settings);
public DataContractJsonSerializer(Type type, System.Runtime.Serialization.Json.DataContractJsonSerializerSettings settings);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, System.Runtime.Serialization.Json.DataContractJsonSerializerSettings? settings);
public DataContractJsonSerializer(Type type, System.Runtime.Serialization.Json.DataContractJsonSerializerSettings? settings);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
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
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Runtime.Serialization.Json.DataContractJsonSerializerSettings -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
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

是序列化或非序列化的實例類型。

settings
DataContractJsonSerializerSettings

JSON 序列化器的設定。

屬性

適用於

DataContractJsonSerializer(Type, IEnumerable<Type>)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化類別的新實例 DataContractJsonSerializer ,以序列化或反序列化指定類型的物件,並包含物件圖中可能存在的已知類型集合。

public:
 DataContractJsonSerializer(Type ^ type, System::Collections::Generic::IEnumerable<Type ^> ^ knownTypes);
public DataContractJsonSerializer(Type type, System.Collections.Generic.IEnumerable<Type> knownTypes);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, System.Collections.Generic.IEnumerable<Type>? knownTypes);
public DataContractJsonSerializer(Type type, System.Collections.Generic.IEnumerable<Type>? knownTypes);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, System.Collections.Generic.IEnumerable<Type>? knownTypes);
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * seq<Type> -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
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

序列化或非序列化的實例類型。

knownTypes
IEnumerable<Type>

其中 a IEnumerable<T>Type 包含了可能存在於物件圖中的類型。

屬性

適用於

DataContractJsonSerializer(Type, XmlDictionaryString)

來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs
來源:
DataContractJsonSerializer.cs

初始化該類別的新實例 DataContractJsonSerializer ,以使用由型別 XmlDictionaryString為 的參數指定的 XML 根元素,序列化或反序列化指定型態的物件。

public:
 DataContractJsonSerializer(Type ^ type, System::Xml::XmlDictionaryString ^ rootName);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, System.Xml.XmlDictionaryString? rootName);
public DataContractJsonSerializer(Type type, System.Xml.XmlDictionaryString? rootName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public DataContractJsonSerializer(Type type, System.Xml.XmlDictionaryString? rootName);
public DataContractJsonSerializer(Type type, System.Xml.XmlDictionaryString rootName);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString -> System.Runtime.Serialization.Json.DataContractJsonSerializer
new System.Runtime.Serialization.Json.DataContractJsonSerializer : Type * System.Xml.XmlDictionaryString -> System.Runtime.Serialization.Json.DataContractJsonSerializer
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
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

是序列化或非序列化的實例類型。

rootName
XmlDictionaryString

一個 XmlDictionaryString 包含內容根元素名稱的 that。

屬性

適用於