<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.
Schema Hierarchy
<system.runtime.serialization>
<dataContractSerializer> of <system.runtime.serialization>
<declaredTypes>
<add> of <declaredTypes> Element
<knownType>
Syntax
<knownType type="String">
<parameter index="Integer"
type="String" />
</knownType>
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 |
---|---|
Specifies a parameter index when the declared type is a generic type. |
Parent Elements
Element | Description |
---|---|
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>
See Also
Reference
<dataContractSerializer>
<add> of <declaredTypes> Element
DataContractSerializer
Other Resources
© 2007 Microsoft Corporation. All rights reserved.
Last Published: 2010-01-05