.NET Framework Class Library for Silverlight
KnownTypeAttribute Class

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)
Syntax

Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct, Inherited := True,  _
    AllowMultiple := True)> _
Public NotInheritable Class KnownTypeAttribute _
    Inherits Attribute
Visual Basic (Usage)
Dim instance As KnownTypeAttribute
C#
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct, Inherited = true, 
    AllowMultiple = true)]
public sealed class KnownTypeAttribute : Attribute
Remarks

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.

NoteNote:

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.

Inheritance Hierarchy

System..::.Object
  System..::.Attribute
    System.Runtime.Serialization..::.KnownTypeAttribute
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Tags :


Page view tracker