NameScope.Add 方法

定義

將項目新增至集合。

多載

Add(KeyValuePair<String,Object>)

將項目新增至集合。

Add(String, Object)

將項目新增至集合。

Add(KeyValuePair<String,Object>)

將項目新增至集合。

public:
 virtual void Add(System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^> item);
public void Add (System.Collections.Generic.KeyValuePair<string,object> item);
abstract member Add : System.Collections.Generic.KeyValuePair<string, obj> -> unit
override this.Add : System.Collections.Generic.KeyValuePair<string, obj> -> unit
Public Sub Add (item As KeyValuePair(Of String, Object))

參數

item
KeyValuePair<String,Object>

KeyValuePair<TKey,TValue> (索引鍵為 String,值為 Object),表示要新增至 XAML 名稱範圍的名稱對應。

實作

例外狀況

item 的其中一個或兩個元件是 null

適用於

Add(String, Object)

將項目新增至集合。

public:
 virtual void Add(System::String ^ key, System::Object ^ value);
public void Add (string key, object value);
abstract member Add : string * obj -> unit
override this.Add : string * obj -> unit
Public Sub Add (key As String, value As Object)

參數

key
String

字串索引鍵,這是要加入之 XAML 名稱範圍對應的名稱。

value
Object

物件值,這是要加入之 XAML 名稱範圍對應的物件參考。

實作

例外狀況

keyvaluenull

備註

這個方法基本上會 Add 包裝,因此不需要在您的 KeyValuePair<TKey,TValue> 使用方式中包含類型。

XAML 命名範圍中的名稱必須使用特定文法來限制您可能用於 API 輸入的 NameScope 字串。 請參閱 XamlName 文法

適用於