Upraviť

Zdieľať cez


DataContractJsonSerializer Constructors

Definition

Initializes a new instance of the DataContractJsonSerializer class.

Overloads

DataContractJsonSerializer(Type)

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type.

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

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 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, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 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, XmlDictionaryString, IEnumerable<Type>)

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, String, IEnumerable<Type>)

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, String, IEnumerable<Type>, Int32, Boolean, IDataContractSurrogate, Boolean)

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 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, String)

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, DataContractJsonSerializerSettings)

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type and serializer settings.

DataContractJsonSerializer(Type, IEnumerable<Type>)

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, XmlDictionaryString)

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)

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

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)

Parameters

type
Type

The type of the instances that is serialized or deserialized.

Applies to

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

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 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)

Parameters

type
Type

The type of the instances that are serialized or deserialized.

rootName
XmlDictionaryString

An XmlDictionaryString that contains the root element name of the content.

knownTypes
IEnumerable<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. The default is the value returned by the Int32.MaxValue property.

ignoreExtensionDataObject
Boolean

true to ignore the IExtensibleDataObject interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. The default is false.

dataContractSurrogate
IDataContractSurrogate

An implementation of the IDataContractSurrogate to customize the serialization process.

alwaysEmitTypeInformation
Boolean

true to emit type information; otherwise, false. The default is false.

Applies to

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

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 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)

Parameters

type
Type

The type of the instances that is serialized or deserialized.

knownTypes
IEnumerable<Type>

An XmlDictionaryString that contains the root element name of the content.

maxItemsInObjectGraph
Int32

An IEnumerable<T> of Type that contains the types that may be present in the object graph.

ignoreExtensionDataObject
Boolean

true to ignore the IExtensibleDataObject interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. The default is false.

dataContractSurrogate
IDataContractSurrogate

An implementation of the IDataContractSurrogate to customize the serialization process.

alwaysEmitTypeInformation
Boolean

true to emit type information; otherwise, false. The default is false.

Applies to

DataContractJsonSerializer(Type, XmlDictionaryString, IEnumerable<Type>)

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

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))

Parameters

type
Type

The type of the instances that is serialized or deserialized.

rootName
XmlDictionaryString

An XmlDictionaryString that contains the root element name of the content.

knownTypes
IEnumerable<Type>

An IEnumerable<T> of Type that contains the types that may be present in the object graph.

Applies to

DataContractJsonSerializer(Type, String, IEnumerable<Type>)

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

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))

Parameters

type
Type

The type of the instances that is serialized or deserialized.

rootName
String

The name of the XML element that encloses the content to serialize or deserialize. The default is "root".

knownTypes
IEnumerable<Type>

An IEnumerable<T> of Type that contains the types that may be present in the object graph.

Applies to

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

Initializes a new instance of the DataContractJsonSerializer class to serialize or deserialize an object of the specified type. 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)

Parameters

type
Type

The type of the instances that is serialized or deserialized.

rootName
String

The name of the XML element that encloses the content to serialize or deserialize. The default is "root".

knownTypes
IEnumerable<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. The default is the value returned by the Int32.MaxValue property.

ignoreExtensionDataObject
Boolean

true to ignore the IExtensibleDataObject interface upon serialization and ignore unexpected data upon deserialization; otherwise, false. The default is false.

dataContractSurrogate
IDataContractSurrogate

An implementation of the IDataContractSurrogate to customize the serialization process.

alwaysEmitTypeInformation
Boolean

true to emit type information; otherwise, false. The default is false.

Applies to

DataContractJsonSerializer(Type, String)

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

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)

Parameters

type
Type

The type of the instances that is serialized or deserialized.

rootName
String

The name of the XML element that encloses the content to serialize or deserialize.

Applies to

DataContractJsonSerializer(Type, DataContractJsonSerializerSettings)

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

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)

Parameters

type
Type

The type of the instances that is serialized or deserialized.

settings
DataContractJsonSerializerSettings

The serializer settings for the JSON serializer.

Applies to

DataContractJsonSerializer(Type, IEnumerable<Type>)

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

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))

Parameters

type
Type

The type of the instances that are serialized or deserialized.

knownTypes
IEnumerable<Type>

An IEnumerable<T> of Type that contains the types that may be present in the object graph.

Applies to

DataContractJsonSerializer(Type, XmlDictionaryString)

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

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)

Parameters

type
Type

The type of the instances that is serialized or deserialized.

rootName
XmlDictionaryString

An XmlDictionaryString that contains the root element name of the content.

Applies to