IValueSerializerContext Interface

Definition

定义提供给 ValueSerializer 的上下文。Defines a context that is provided to a ValueSerializer. 该上下文可用于允许序列化的特殊情况或不同的序列化模式。The context can be used to enable special cases of serialization or different modes of serialization.

public interface class IValueSerializerContext : IServiceProvider, System::ComponentModel::ITypeDescriptorContext
public interface IValueSerializerContext : IServiceProvider, System.ComponentModel.ITypeDescriptorContext
type IValueSerializerContext = interface
    interface ITypeDescriptorContext
    interface IServiceProvider
Public Interface IValueSerializerContext
Implements IServiceProvider, ITypeDescriptorContext
Implements

Remarks

IValueSerializerContext 接口是一种专用形式的 ITypeDescriptorContext 上下文,用作值序列化程序的 Convert*String / CanConvert*String 方法的输入参数之一,其方式与 ITypeDescriptorContext 用于 Convert* / CanConvert* TypeConverter的上下文相同。The IValueSerializerContext interface is a specialized form of the ITypeDescriptorContext context, and is used as one of the input parameters for Convert*String / CanConvert*String methods of a value serializer in the same way as ITypeDescriptorContext is used for context of Convert* / CanConvert* for a TypeConverter.

WPF 中实现 ValueSerializer 并因此使用上下文 IValueSerializerContext 的公共类型在 System.Windows.ConvertersSystem.Windows.Media.Converters 命名空间中。Public types in WPF that implement a ValueSerializer and thus use IValueSerializerContext for context are found in the System.Windows.Converters and System.Windows.Media.Converters namespaces.

在 .NET Framework 的以前版本中,此接口存在于 WPF 特定的程序集 WindowsBase 中。In previous versions of the .NET Framework, this interface existed in the WPF-specific assembly WindowsBase. .NET Framework 4.NET Framework 4中,IValueSerializerContext 在 system.exception 程序集中。In .NET Framework 4.NET Framework 4, IValueSerializerContext is in the System.Xaml assembly. 有关详细信息,请参阅 Types Migrated from WPF to System.XamlFor more information, see Types Migrated from WPF to System.Xaml.

Properties

Container

获取表示此 TypeDescriptor 请求的容器。Gets the container representing this TypeDescriptor request.

(Inherited from ITypeDescriptorContext)
Instance

获取与此类型说明符请求相连接的对象。Gets the object that is connected with this type descriptor request.

(Inherited from ITypeDescriptorContext)
PropertyDescriptor

获取与给定上下文项相关联的 PropertyDescriptorGets the PropertyDescriptor that is associated with the given context item.

(Inherited from ITypeDescriptorContext)

Methods

GetService(Type)

获取指定类型的服务对象。Gets the service object of the specified type.

(Inherited from IServiceProvider)
GetValueSerializerFor(PropertyDescriptor)

获取给定属性描述符的 ValueSerializerGets a ValueSerializer for the given property descriptor.

GetValueSerializerFor(Type)

获取与指定类型关联的 ValueSerializerGets the ValueSerializer associated with the specified type.

OnComponentChanged()

引发 ComponentChanged 事件。Raises the ComponentChanged event.

(Inherited from ITypeDescriptorContext)
OnComponentChanging()

引发 ComponentChanging 事件。Raises the ComponentChanging event.

(Inherited from ITypeDescriptorContext)

Applies to

See also