NameScope.Add Method (String, Object)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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.

Exception Condition

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
Available since 4.0
Return to top