共用方式為


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 元素。 如果專案定義于目前的組態檔中,則會從組態檔中移除其專案。 要移除的物件必須存在於集合中;如果沒有, ConfigurationException 則會擲回 。

適用於

另請參閱