ClientTargetCollection.Remove Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈