Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

KnownTypeAttribute::MethodName Property

 

Gets the name of a method that will return a list of types that should be recognized during serialization or deserialization.

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

public:
property String^ MethodName {
	String^ get();
}

Property Value

Type: System::String^

A String that contains the name of the method on the type defined by the KnownTypeAttribute class.

The method must exist on the class or structure that the KnownTypeAttribute is applied to, must be static, must accept no parameters, and must return an instance of any type that implements the generic IEnumerable<T> interface, such as the Collection<T> class, or an array of Type objects.

The method is called once per application domain when the data contract is loaded for the type.

The following example uses the methodName parameter to identify a method in the type that contains an array of Type objects.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft