TypeDescriptionProvider.GetExtendedTypeDescriptor(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取给定对象的扩展自定义类型描述符。
public:
virtual System::ComponentModel::ICustomTypeDescriptor ^ GetExtendedTypeDescriptor(System::Object ^ instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public virtual System.ComponentModel.ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance);
public virtual System.ComponentModel.ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
abstract member GetExtendedTypeDescriptor : obj -> System.ComponentModel.ICustomTypeDescriptor
override this.GetExtendedTypeDescriptor : obj -> System.ComponentModel.ICustomTypeDescriptor
abstract member GetExtendedTypeDescriptor : obj -> System.ComponentModel.ICustomTypeDescriptor
override this.GetExtendedTypeDescriptor : obj -> System.ComponentModel.ICustomTypeDescriptor
Public Overridable Function GetExtendedTypeDescriptor (instance As Object) As ICustomTypeDescriptor
参数
- instance
- Object
要为其获取扩展类型描述符的对象。
返回
可为对象提供扩展元数据的一个 ICustomTypeDescriptor 。
- 属性
注解
扩展类型描述符是一个自定义类型描述符,它提供其他对象已添加到此对象的属性,但实际上未在对象上定义。 例如,在 .NET Framework 组件模型中,实现 IExtenderProvider 接口的对象可以将属性附加到驻留在同一逻辑容器中的其他对象。 重载 GetTypeDescriptor 的方法不返回提供这些额外扩展属性的类型描述符。 该方法 GetExtendedTypeDescriptor 返回这些扩展属性集。 这 TypeDescriptor 两个属性集合的结果将自动合并。 虽然 .NET Framework 组件模型仅支持扩展属性,但如果类型说明提供程序支持扩展属性,GetExtendedTypeDescriptor可用于扩展属性和事件。
GetExtendedTypeDescriptor 默认情况下,如果 virtual 未传递父提供程序,则返回一个自定义类型描述符,该描述符返回空结果。 如果传递了父提供程序,此方法将调用父提供程序 GetExtendedTypeDescriptor 的方法。