UrlMappingCollection.Remove 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從集合中移除一個 UrlMapping 物件。
多載
| 名稱 | Description |
|---|---|
| Remove(String) |
從集合中移除 UrlMapping 指定名稱的物件。 |
| Remove(UrlMapping) |
從集合中移除指定的 UrlMapping 物件。 |
Remove(String)
從集合中移除 UrlMapping 指定名稱的物件。
public:
void Remove(System::String ^ name);
public void Remove(string name);
member this.Remove : string -> unit
Public Sub Remove (name As String)
參數
- name
- String
要從集合中移除的物件名稱 UrlMapping 。
範例
以下程式碼範例將物件從 中移除。UrlMappingUrlMappingCollection
參考課堂主題中的 UrlMappingCollection 程式碼範例,學習如何取得該集合。
// Remove the URL with the
// specified name from the collection
// (if exists).
urlMappings.Remove("~/default.aspx");
// Update the configuration file.
if (!urlMappingSection.IsReadOnly())
configuration.Save();
' Remove the URL with the
' specified name from the collection
' (if exists).
urlMappings.Remove("~/home.aspx")
' Update the configuration file.
If Not urlMappingSection.IsReadOnly() Then
configuration.Save()
End If
備註
該Remove方法會刪除該區段中add當前階層層級的元素urlMappings,並插入一個remove元素。 移除元素實際上移除了階層 add 結構中父組態檔案中定義的元素參考,但不會刪除該元素。
另請參閱
適用於
Remove(UrlMapping)
從集合中移除指定的 UrlMapping 物件。
public:
void Remove(System::Web::Configuration::UrlMapping ^ urlMapping);
public void Remove(System.Web.Configuration.UrlMapping urlMapping);
member this.Remove : System.Web.Configuration.UrlMapping -> unit
Public Sub Remove (urlMapping As UrlMapping)
參數
- urlMapping
- UrlMapping
要從集合中移除的 UrlMapping 物件。
範例
以下程式碼範例將物件從 中移除。UrlMappingUrlMappingCollection
參考課堂主題中的 UrlMappingCollection 程式碼範例,學習如何取得該集合。
// Create a UrlMapping object.
urlMapping = new UrlMapping(
"~/home.aspx", "~/default.aspx?parm1=1");
// Remove it from the collection
// (if exists).
urlMappings.Remove(urlMapping);
// Update the configuration file.
if (!urlMappingSection.IsReadOnly())
configuration.Save();
' Create a UrlMapping object.
urlMapping = New UrlMapping( _
"~/home.aspx", "~/default.aspx?parm1=1")
' Remove it from the collection
' (if exists).
urlMappings.Remove(urlMapping)
' Update the configuration file.
If Not urlMappingSection.IsReadOnly() Then
configuration.Save()
End If
備註
該Remove方法會刪除該區段中add當前階層層級的元素urlMappings,並插入一個remove元素。 移除元素實際上移除了階層 add 結構中父組態檔案中定義的元素參考,但不會刪除該元素。