共用方式為


KnownTypeAttribute Constructor (String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes a new instance of the KnownTypeAttribute class with the name of a method that returns an IEnumerable of known types.

Namespace:  System.Runtime.Serialization
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

Syntax

'Declaration
Public Sub New ( _
    methodName As String _
)
public KnownTypeAttribute(
    string methodName
)

Parameters

  • methodName
    Type: System.String
    The name of the method that returns an IEnumerable of types used when serializing or deserializing data.

Remarks

This constructor uses a method name that matches a method of the class. The method returns a IEnumerable<T> of Type objects. During serialization or deserialization, the types found in the collection can be used within the root type to which the attribute is applied.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

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