UrlMappingCollection.Remove 方法

定义

UrlMapping 集合中删除对象。

重载

名称 说明
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

示例

下面的代码示例从中UrlMapping删除对象UrlMappingCollection

请参阅类主题中的 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 。 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 从集合中移除的对象。

示例

下面的代码示例从中UrlMapping删除对象UrlMappingCollection

请参阅类主题中的 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 。 remove 元素有效地删除了对 add 层次结构中较高级别的父配置文件中定义的元素的引用,但不删除它。

另请参阅

适用于