ValueSerializer.TypeReferences(Object, IValueSerializerContext) 方法

定义

获取 ValueSerializer 引用的类型的枚举。Gets an enumeration of the types referenced by the ValueSerializer.

public:
 virtual System::Collections::Generic::IEnumerable<Type ^> ^ TypeReferences(System::Object ^ value, System::Windows::Markup::IValueSerializerContext ^ context);
public virtual System.Collections.Generic.IEnumerable<Type> TypeReferences (object value, System.Windows.Markup.IValueSerializerContext context);
abstract member TypeReferences : obj * System.Windows.Markup.IValueSerializerContext -> seq<Type>
override this.TypeReferences : obj * System.Windows.Markup.IValueSerializerContext -> seq<Type>
Public Overridable Function TypeReferences (value As Object, context As IValueSerializerContext) As IEnumerable(Of Type)

参数

value
Object

要序列化的值。The value being serialized.

context
IValueSerializerContext

用于转换的上下文信息。Context information that is used for conversion.

返回

IEnumerable<Type>

此序列化程序所转换的类型。The types converted by this serializer.

注解

ValueSerializer转换应包含在返回的枚举中的任何类型。Any types a ValueSerializer converts should be included in the returned enumeration. 这允许序列化程序确保反序列化程序具有此序列化程序所转换的类型的足够信息。This allows a serializer to ensure a de-serializer has enough information about the types this serializer converts.

重写此方法是一种高级方案。Overriding this method is an advanced scenario. 仅当您实现的系统中的 CLR 类型系统所有者属性关系可用于 XAML 架构上下文时,才需要重写。Overriding should only be necessary if you are implementing a system where CLR type system ownertype-property relationships available to a XAML schema context do not report enough information.

WPF 用法说明WPF Usage Notes

WPFWPF属性系统实现了一个重写的内部值序列化程序, TypeReferences 因为某个依赖属性具有可添加所有者的概念。The WPFWPF property system implements an internal value serializer that overrides TypeReferences because a dependency property has a concept that it can have added owners. WPFWPF表达式也具有特殊的内部处理。expressions also have special internal handling.

适用于