This documentation is archived and is not being maintained.

NameScope.Add Method (String, Object)

Adds an item to the collection.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public void Add(
	string key,
	Object value


Type: System.String
The string key, which is the name of the XAML namescope mapping to add.
Type: System.Object
The object value, which is the object reference of the XAML namescope mapping to add.


IDictionary<TKey, TValue>.Add(TKey, TValue)


key or value is null.

This method basically wraps Add so that it is not necessary to involve the KeyValuePair<TKey, TValue> type in your usage.

Names in a XAML namescope must use a particular grammar that restricts the strings you might use for inputs of NameScope API. See XamlName Grammar.

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