语言

XamlTypeInvoker.GetAddMethod(XamlType) 方法

定义

返回 Add 与集合或字典相关的相关方法 XamlTypeInvoker 。

public:
 virtual System::Reflection::MethodInfo ^ GetAddMethod(System::Xaml::XamlType ^ contentType);
public virtual System.Reflection.MethodInfo GetAddMethod(System.Xaml.XamlType contentType);
abstract member GetAddMethod : System.Xaml.XamlType -> System.Reflection.MethodInfo
override this.GetAddMethod : System.Xaml.XamlType -> System.Reflection.MethodInfo
Public Overridable Function GetAddMethod (contentType As XamlType) As MethodInfo

参数

contentType
XamlType

XamlType 方法使用的 Add 项类型。

返回

方法MethodInfo的 CLR Add 信息,或 null。

例外

contentType 是 null。

注解

如果此方法不是可写集合或字典,null则应返回XamlType此方法XamlTypeInvoker。 具体而言,应返回null返回的情况XamlType.LookupCollectionKindNone。

Important

如果不访问完全受信任的 XAML 类型系统,此方法可能会向调用方报告虚假 MethodInfo 信息。

继承者说明

对于基于未知的情况,基实现返回null,其中包括其中的事例XamlTypeInvokerXamlTypeUnderlyingType。XamlTypenull 它还返回 null if ItemType is null.

XAML 集合可能具有多个 Add 方法,因为 XAML 集合可能支持多个内容类型(请参阅 AllowedContentTypes,或查看 ContentWrapperAttribute,了解有关WPF中此概念的一个实现的信息)。 默认实现使用内部逻辑根据提供的 contentType签名和类型返回最佳匹配项。

适用于