Specifies types that should be recognized by the DataContractSerializer when serializing or deserializing a given type.
Namespace:
System.Runtime.Serialization
Assembly:
System.Runtime.Serialization (in System.Runtime.Serialization.dll)
Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct, Inherited := True, _
AllowMultiple := True)> _
Public NotInheritable Class KnownTypeAttribute _
Inherits Attribute
Dim instance As KnownTypeAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct, Inherited = true,
AllowMultiple = true)]
public sealed class KnownTypeAttribute : Attribute
Apply the KnownTypeAttribute attribute to a type to indicate to the DataContractSerializer the types that should be recognized when serializing or deserializing an instance of the type to which the attribute is applied. This attribute could also be recognized by other serializers that understand data contracts.
Note: |
|---|
In your code, you can use the word KnownType instead of the longer KnownTypeAttribute. |
You can either apply exactly one KnownTypeAttribute instance with the MethodName property set, or one or more KnownTypeAttribute instances with the Type property set.
System..::.Object
System..::.Attribute
System.Runtime.Serialization..::.KnownTypeAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference