語言

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。

備註

此方法應在 for null this XamlType 非可寫集合或字典的情況下回傳XamlTypeInvoker。 具體來說,應在返回nullXamlType.LookupCollectionKind的情況下返回None。

Important

如果你沒有存取完全受信任的 XAML 類型系統,這種方法可能會向呼叫者回報錯誤 MethodInfo 資訊。

給繼承者的注意事項

基礎實作會回傳 null a 基於未知 XamlTypeInvoker的情況下,包括 XamlType 的 UnderlyingTypeXamlType 為 null 的情況。 若null為 ,ItemType則 亦回傳null。

XAML 集合可能包含多個 Add 方法,因為一個 XAML 集合可能支援多種內容類型(參見 AllowedContentTypes,或參見 ContentWrapperAttribute 以了解 WPF 中某一種實作)。 預設實作會根據簽章和所提供的 contentType類型回傳最佳匹配。

適用於