NamespaceCollection.Remove(String) 方法

定義

從集合中移除 NamespaceInfo 包含指定金鑰的物件。

public:
 void Remove(System::String ^ s);
public void Remove(string s);
member this.Remove : string -> unit
Public Sub Remove (s As String)

參數

s
String

要從集合中移除物件的命名空間 NamespaceInfo

例外狀況

集合中沒有 NamespaceInfo 帶有指定金鑰的物件。

-或-

該元素已經被移除。

-或-

本合集為唯讀。

範例

下列程式代碼範例示範如何使用 Remove 方法。 此程式碼範例是本類別更大範例 PagesSection 的一部分。

// Execute the Remove method.
pagesSection.Namespaces.Remove("System.Collections");
' Execute the Remove method.
pagesSection.Namespaces.Remove("System.Collections")

備註

若指定元素定義於較高階的設定檔中,此方法會在當前應用程式層級的適當區段插入元素 remove 。 若該元素在目前設定檔中定義,則其條目將從設定檔中移除。 要移除的物件必須存在於集合中;若不成功,則擲出 A ConfigurationException

適用於

另請參閱