This documentation is archived and is not being maintained.

XamlTypeInvoker.GetAddMethod Method

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

Namespace:  System.Xaml.Schema
Assembly:  System.Xaml (in System.Xaml.dll)

public virtual MethodInfo GetAddMethod(
	XamlType contentType


Type: System.Xaml.XamlType
XamlType for the item type that is used by the Add method.

Return Value

Type: System.Reflection.MethodInfo
CLR MethodInfo information for the Add method, or null.


contentType is null.

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.

Security noteSecurity Note

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 Implementers

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 XamlType.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.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.