<parameter>
Specifies the generic parameter when a declared type is a generic type.
<configuration>
<system.runtime.serialization>
<dataContractSerializer>
<declaredTypes>
<add>
<knownType>
<parameter>
Syntax
<parameter index="Integer"
type="String" />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Description |
---|---|
index | When the declared type is a generic type, specifies the generic parameter that will return the known type. |
type | A string that describes the known type used for serialization and deserialization. |
index Attribute
Value | Description |
---|---|
"0" | The first parameter in the generic type. For example, a List<T> has only one parameter. If it is used as the declared type, the index would be set to "0". |
"1" | The second parameter in a generic type. For example, a Dictionary<TKey,TValue> has two parameters. If the known type is returned by the second parameter, set the index attribute to "1". |
Child Elements
None.
Parent Elements
Element | Description |
---|---|
<knownType> | Specifies a known type that can be returned by a field or property of the declared type. |
Remarks
For more information about known types, see Data Contract Known Types and DataContractSerializer.
See the <dataContractSerializer> for an example of using this element.
This configuration element cannot have both attributes at the same time. If both attributes are set, a ConfigurationErrorsException occurs.