NameScope.Add 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將專案加入至集合。
多載
| 名稱 | Description |
|---|---|
| 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 命名範圍映射的物件參考。
實作
例外狀況
key 或 value 為 null。
備註
這種方法基本上是包 Add 覆式的,使得使用時不必使用這種 KeyValuePair<TKey,TValue> 類型。
XAML 命名範圍中的名稱必須使用特定文法,限制你作為 API 輸入 NameScope 的字串。 參見 XamlName 文法。