Επεξεργασία

Κοινή χρήση μέσω


ClientTargetCollection.Remove Method

Definition

Removes a ClientTarget object from the collection.

Overloads

Remove(String)

Removes the ClientTarget object with the specified alias from the collection.

Remove(ClientTarget)

Removes the specified ClientTarget object from the collection.

Remove(String)

Removes the ClientTarget object with the specified alias from the collection.

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

Parameters

name
String

The alias of the ClientTarget to remove.

Examples

The following code example removes the ClientTarget object from the ClientTargetCollection collection.

For information about how to get the collection, see the code example in the ClientTargetCollection class overview.


// 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

Remarks

The Remove method deletes the add element in the clientTarget section at the current hierarchy level and inserts a remove element. The remove element effectively removes the reference to the add element defined in the parent configuration files at higher levels in the hierarchy but does not delete it.

See also

Applies to

Remove(ClientTarget)

Removes the specified ClientTarget object from the collection.

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)

Parameters

clientTarget
ClientTarget

The ClientTarget to remove.

Examples

The following code example removes the ClientTarget object from the ClientTargetCollection collection.

For information about how to get the collection, see the code example in the ClientTargetCollection class overview.


// 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

Remarks

The Remove method deletes the add element in the clientTarget section at the current hierarchy level and inserts a remove element. The remove element effectively removes the reference to the add element defined in the parent configuration files at higher levels in the hierarchy but does not delete it.

See also

Applies to