Читати англійською Редагувати

Поділитися через


NameScope.Add Method

Definition

Adds an item to the collection.

Overloads

Add(KeyValuePair<String,Object>)

Adds an item to the collection.

Add(String, Object)

Adds an item to the collection.

Add(KeyValuePair<String,Object>)

Adds an item to the collection.

C#
public void Add(System.Collections.Generic.KeyValuePair<string,object> item);

Parameters

item
KeyValuePair<String,Object>

A KeyValuePair<TKey,TValue> (key is String, value is Object) that represents the name mapping to add to the XAML namescope.

Implements

Exceptions

Either or both components of item are null.

Applies to

.NET Framework 4.8.1 та інші версії
Продукт Версії
.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, 10

Add(String, Object)

Adds an item to the collection.

C#
public void Add(string key, object value);

Parameters

key
String

The string key, which is the name of the XAML namescope mapping to add.

value
Object

The object value, which is the object reference of the XAML namescope mapping to add.

Implements

Exceptions

key or value is null.

Remarks

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.

Applies to

.NET Framework 4.8.1 та інші версії
Продукт Версії
.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, 10