ResourceDictionary.Remove(Object) 方法

定義

將具有指定索引鍵的項目從基本字典中移除。Removes the entry with the specified key from the base dictionary.

public:
 virtual void Remove(System::Object ^ key);
public void Remove (object key);
abstract member Remove : obj -> unit
override this.Remove : obj -> unit
Public Sub Remove (key As Object)

參數

key
Object

要移除之項目的索引鍵。Key of the entry to remove.

實作

例外狀況

ResourceDictionary 已鎖定或屬於唯讀。The ResourceDictionary is locked or read-only.

備註

如果不 ResourceDictionary 包含具有指定索引鍵的專案,則會 ResourceDictionary 維持不變。If the ResourceDictionary does not contain an element with the specified key, the ResourceDictionary remains unchanged. 不會引發任何例外狀況。No exception is raised.

這個方法不會移除中的索引鍵 MergedDictionariesThis method does not remove keys from the MergedDictionaries. 您必須從集合中取得特定的, ResourceDictionary 才能移除這些金鑰,但這可能無法使用,因為您通常會從遠端存取這類字典。You must obtain the specific ResourceDictionary from the collection to remove those keys, but that might not be possible because you are typically accessing such a dictionary remotely.

適用於