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.

ValueSerializer::GetSerializerFor Method (PropertyDescriptor^, IValueSerializerContext^)

 

Gets the ValueSerializer declared for the specified property, using the specified context.

Namespace:   System.Windows.Markup
Assembly:  System.Xaml (in System.Xaml.dll)

public:
static ValueSerializer^ GetSerializerFor(
	PropertyDescriptor^ descriptor,
	IValueSerializerContext^ context
)

Parameters

descriptor
Type: System.ComponentModel::PropertyDescriptor^

Descriptor for the property to be serialized.

context
Type: System.Windows.Markup::IValueSerializerContext^

Context information that is used for conversion.

Return Value

Type: System.Windows.Markup::ValueSerializer^

The serializer associated with the specified property.

Exception Condition
ArgumentNullException

descriptor is null.

Rather than relying purely on attributes reported in the CLR type system, this overload uses the context as a service, and calls the service's implementation of IValueSerializerContext::GetValueSerializerFor. The IValueSerializerContext::GetValueSerializerFor implementation would typically also rely on the descriptor, but might implement special behavior for certain contexts.

This method should be called when the caller has an available IValueSerializerContext from a service. This will ensure that the correct ValueSerializer is returned for the specific context.

If the context returns null from its IValueSerializerContext::GetValueSerializerFor for your specified descriptor, or if the context you specify is null, then behavior is identical to calling the GetSerializerFor(PropertyDescriptor^) overload.

.NET Framework
Available since 3.0
Return to top
Show:
© 2017 Microsoft