ClientTargetCollection.Remove 方法

定义

ClientTarget 集合中删除对象。

重载

名称 说明
Remove(String)

ClientTarget从集合中删除具有指定别名的对象。

Remove(ClientTarget)

从集合中删除指定的 ClientTarget 对象。

Remove(String)

ClientTarget从集合中删除具有指定别名的对象。

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

参数

name
String

要删除的 ClientTarget 别名。

示例

下面的代码示例从 ClientTarget 集合中删除对象 ClientTargetCollection

有关如何获取集合的信息,请参阅类概述中的 ClientTargetCollection 代码示例。


// Remove the client target with the
// specified alias from the collection
// (if exists).
clientTargets.Remove("my alias");

// Update the configuration file.
if (!clientTargetSection.IsReadOnly())
  configuration.Save();
' Remove the client target with the
' specified alias from the collection
' (if exists).
clientTargets.Remove("my alias")

' Update the configuration file.
If Not clientTargetSection.IsReadOnly() Then
    configuration.Save()
End If

注解

该方法 Remove 删除 add 当前层次结构级别的节中的 clientTarget 元素,并插入元素 remove 。 该 remove 元素有效地删除了 add 对层次结构中较高级别的父配置文件中定义的元素的引用,但不删除它。

另请参阅

适用于

Remove(ClientTarget)

从集合中删除指定的 ClientTarget 对象。

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

参数

clientTarget
ClientTarget

ClientTarget 删除的。

示例

下面的代码示例从 ClientTarget 集合中删除对象 ClientTargetCollection

有关如何获取集合的信息,请参阅类概述中的 ClientTargetCollection 代码示例。


// Create a ClientTarget object.
clientTarget = new ClientTarget(
  "my alias", "My User Agent");

// Remove it from the collection
// (if exists).
clientTargets.Remove(clientTarget);

// Update the configuration file.
if (!clientTargetSection.IsReadOnly())
  configuration.Save();
' Create a ClientTarget object.
clientTarget = New ClientTarget( _
"my alias", "My User Agent")

' Remove it from the collection
' (if exists).
clientTargets.Remove(clientTarget)

' Update the configuration file.
If Not clientTargetSection.IsReadOnly() Then
    configuration.Save()
End If

注解

该方法 Remove 删除 add 当前层次结构级别的节中的 clientTarget 元素,并插入元素 remove 。 该 remove 元素有效地删除了 add 对层次结构中较高级别的父配置文件中定义的元素的引用,但不删除它。

另请参阅

适用于