DataContractJsonSerializer 构造函数

定义

初始化 DataContractJsonSerializer 类的新实例。

重载

名称 说明
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 ,以使用类型参数指定的 XML 根元素序列化或反序列化指定类型的 XmlDictionaryString对象,以及对象图中可能存在的已知类型的集合。

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 ,以使用类型参数指定的 XML 根元素序列化或反序列化指定类型的 XmlDictionaryString对象。

DataContractJsonSerializer(Type)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
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 包含内容的根元素名称。

knownTypes
IEnumerable<Type>

IEnumerable<T>其中一个Type类型包含对象图中可能存在的已知类型。

maxItemsInObjectGraph
Int32

要序列化或反序列化的图形中项的最大数目。 默认值为 Int32.MaxValue 属性返回的值。

ignoreExtensionDataObject
Boolean

如果忽略 序列化时的接口,并在反序列化时忽略意外数据,则为 ;否则为 < a1/ >。 默认值为 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 包含内容的根元素名称。

maxItemsInObjectGraph
Int32

IEnumerable<T>其中一个Type包含对象图中可能存在的类型。

ignoreExtensionDataObject
Boolean

如果忽略 序列化时的接口,并在反序列化时忽略意外数据,则为 ;否则为 < a1/ >。 默认值为 false

dataContractSurrogate
IDataContractSurrogate

用于自定义序列化过程的实现 IDataContractSurrogate

alwaysEmitTypeInformation
Boolean

true 发出类型信息;否则,为 false. 默认值为 false

适用于

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs

初始化类的新实例 DataContractJsonSerializer ,以使用类型参数指定的 XML 根元素序列化或反序列化指定类型的 XmlDictionaryString对象,以及对象图中可能存在的已知类型的集合。

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 包含内容的根元素名称。

knownTypes
IEnumerable<Type>

IEnumerable<T>其中一个Type包含对象图中可能存在的类型。

属性

适用于

DataContractJsonSerializer(Type, String, IEnumerable<Type>)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
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>

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>

IEnumerable<T>其中一个Type包含对象图中可能存在的类型。

maxItemsInObjectGraph
Int32

要序列化或反序列化的图形中项的最大数目。 默认值为 Int32.MaxValue 属性返回的值。

ignoreExtensionDataObject
Boolean

如果忽略 序列化时的接口,并在反序列化时忽略意外数据,则为 ;否则为 < a1/ >。 默认值为 false

dataContractSurrogate
IDataContractSurrogate

用于自定义序列化过程的实现 IDataContractSurrogate

alwaysEmitTypeInformation
Boolean

true 发出类型信息;否则,为 false. 默认值为 false

适用于

DataContractJsonSerializer(Type, String)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
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)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
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>)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
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>

IEnumerable<T>其中一个Type包含对象图中可能存在的类型。

属性

适用于

DataContractJsonSerializer(Type, XmlDictionaryString)

Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs
Source:
DataContractJsonSerializer.cs

初始化类的新实例 DataContractJsonSerializer ,以使用类型参数指定的 XML 根元素序列化或反序列化指定类型的 XmlDictionaryString对象。

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 包含内容的根元素名称。

属性

适用于