HttpModuleActionCollection.Remove 方法

定义

从集合中删除模块 HttpModuleAction

重载

名称 说明
Remove(String)

从集合中删除对象 HttpModuleAction

Remove(HttpModuleAction)

从集合中删除对象 HttpModuleAction

注解

若要从其集合中删除模块,可以使用列出的重载方法之一。

Remove(String)

从集合中删除对象 HttpModuleAction

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

参数

name
String

标识 HttpModuleAction 要从集合中删除的对象的键。

例外

集合中没有 HttpModuleAction 具有指定键的对象,该元素已被删除,或集合为只读。

示例

以下示例演示如何从集合中删除模块 HttpModuleAction


// Remove the module from the collection.
if (!httpModulesSection.SectionInformation.IsLocked)
{
    modulesCollection.Remove("TimerModule");
    configuration.Save();
}
' Remove the module from the collection.
If Not httpModulesSection.SectionInformation.IsLocked Then
    modulesCollection.Remove("MyModule2Name")
    configuration.Save()
End If

注解

此方法将元素插入 <remove> 到配置文件的相应节中,用于在较高级别的配置文件中定义的任何元素。 如果元素在当前配置文件的相应节中定义,则会从配置文件中删除其条目。 要删除的对象必须存在于集合中。

适用于

Remove(HttpModuleAction)

从集合中删除对象 HttpModuleAction

public:
 void Remove(System::Web::Configuration::HttpModuleAction ^ action);
public void Remove(System.Web.Configuration.HttpModuleAction action);
member this.Remove : System.Web.Configuration.HttpModuleAction -> unit
Public Sub Remove (action As HttpModuleAction)

参数

action
HttpModuleAction

要删除的 HttpModuleAction 模块。

例外

集合中不存在传递 HttpModuleAction 的对象、已删除元素或集合是只读的。

示例

以下示例演示如何从集合中删除模块 HttpModuleAction

// Set the module object.
HttpModuleAction ModuleAction2 = 
    new HttpModuleAction("MyModule2Name",
    "MyModule2Type");

// Remove the module from the collection.
if (!httpModulesSection.SectionInformation.IsLocked)
{
    modulesCollection.Remove(ModuleAction2);
    configuration.Save();
}
' Set the module object.
Dim ModuleAction2 As New HttpModuleAction( _
"MyModule2Name", "MyModule2Type")
' Remove the module from the collection.
If Not httpModulesSection.SectionInformation.IsLocked Then
    modulesCollection.Remove(ModuleAction2)
    configuration.Save()
End If

注解

此方法将元素插入 <remove> 到配置文件的相应节中,用于在较高级别的配置文件中定义的任何元素。 如果元素在当前配置文件的相应节中定义,则会从配置文件中删除其条目。 要删除的对象必须存在于集合中。

适用于