<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 |
---|---|
indexindex | Если объявленный тип является общим типом, указывает общий параметр, который возвращает известный тип.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. |
Атрибут indexindex Attribute
ЗначениеValue | ОписаниеDescription |
---|---|
"0""0" | Первый параметр в общем типе.The first parameter in the generic type. Например, у List<T> есть только один параметр.For example, a List<T> has only one parameter. Если он используется как объявленный тип, индексу присваивается значение 0.If it is used as the declared type, the index would be set to "0". |
"1""1" | Второй параметр в общем типе.The second parameter in a generic type. Например, у Dictionary<TKey,TValue> есть два параметра.For example, a Dictionary<TKey,TValue> has two parameters. Если известный тип возвращается вторым параметром, атрибуту index присваивается значение 1.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. |
RemarksRemarks
Дополнительные сведения об известных типах см. в статье о известных типах контрактов данных и DataContractSerializer .For more information about known types, see Data Contract Known Types and DataContractSerializer.
<dataContractSerializer>Пример использования этого элемента см. в разделе.See the <dataContractSerializer> for an example of using this element.
У данного элемента конфигурации не может одновременно быть оба атрибута.This configuration element cannot have both attributes at the same time. Если заданы оба атрибута, возникает исключение ConfigurationErrorsException.If both attributes are set, a ConfigurationErrorsException occurs.