XamlTypeInvoker.GetAddMethod(XamlType) Method

Definition

Returns the relevant Add method for a XamlTypeInvoker that is relevant to a collection or dictionary.

C#
public virtual System.Reflection.MethodInfo GetAddMethod (System.Xaml.XamlType contentType);

Parameters

contentType
XamlType

XamlType for the item type that is used by the Add method.

Returns

CLR MethodInfo information for the Add method, or null.

Exceptions

contentType is null.

Remarks

This method should return null for cases where the XamlType for this XamlTypeInvoker is not a writeable collection or dictionary. Specifically, should return null for cases where XamlType.LookupCollectionKind returns None.

중요

If you are not accessing a fully trusted XAML type system, this method has the potential to report false MethodInfo information to callers.

Notes to Inheritors

The base implementation returns null for cases where a XamlTypeInvoker is based on an unknown XamlType, which includes cases where the UnderlyingType of the XamlType is null. It also returns null if ItemType is null.

XAML collections potentially have more than one Add method, because a XAML collection can potentially support more than one content type (see AllowedContentTypes, or see ContentWrapperAttribute for information about one implementation of this concept in WPF). The default implementation uses internal logic to return the best match based on the signatures and the type of the supplied contentType.

Applies to

제품 버전
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9