<knownType>
Specifies a type to be used by DataContractSerializer during deserialization. The element specifies a "known type" that is returned by a field or property of a "declared type." For more information, see Data Contract Known Types.
<configuration>
<system.runtime.serialization>
<dataContractSerializer>
<declaredTypes>
<add>
<knownType>
Syntax
<knownType type="String">
<parameter index="Integer"
type="String" />
</knownType>
Type
string
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Description |
---|---|
type | Specifies the type (including namespace), assembly name, version, culture, and public key token. |
Child Elements
Element | Description |
---|---|
<parameter> | Specifies a parameter index when the declared type is a generic type. |
Parent Elements
Element | Description |
---|---|
<add> | Adds a declared type to the collection of declared types. |
Remarks
For more information about known types, see Data Contract Known Types and DataContractSerializer.
See the <dataContractSerializer> for an example of using this element.
Example
<add type="MyCompany.Library.Shape,
MyAssembly, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=XXXXXX, processorArchitecture=MSIL">
<knownType type="MyCompany.Library.Circle,
MyAssembly, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=XXXXXX,
processorArchitecture=MSIL"/>
</add>