JsonMediaTypeFormatter.CreateDefaultSerializer Method
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Creates the default serializer used to serialize objects of the specified type.
Namespace: System.Net.Http.Formatting
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Syntax
'Declaration
Public Shared Function CreateDefaultSerializer ( _
type As Type, _
knownTypes As IEnumerable(Of Type), _
allowReferenceDataContracts As Boolean _
) As DataContractJsonSerializer
public static DataContractJsonSerializer CreateDefaultSerializer(
Type type,
IEnumerable<Type> knownTypes,
bool allowReferenceDataContracts
)
public:
static DataContractJsonSerializer^ CreateDefaultSerializer(
Type^ type,
IEnumerable<Type^>^ knownTypes,
bool allowReferenceDataContracts
)
static member CreateDefaultSerializer :
type:Type *
knownTypes:IEnumerable<Type> *
allowReferenceDataContracts:bool -> DataContractJsonSerializer
public static function CreateDefaultSerializer(
type : Type,
knownTypes : IEnumerable<Type>,
allowReferenceDataContracts : boolean
) : DataContractJsonSerializer
Parameters
- type
Type: System.Type
The type of object to create a serializer for.
- knownTypes
Type: System.Collections.Generic.IEnumerable<Type>
A <see cref="T:System.Collections.Generic.IEnumerable`1" /> of Type that contains the known types that may be present in the object graph.
- allowReferenceDataContracts
Type: System.Boolean
true to create a serializer that can handle reference data contracts, otherwise false.
Return Value
Type: System.Runtime.Serialization.Json.DataContractJsonSerializer
A DataContractJsonSerializer that can serialize instances of the specified type.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.