ClientTargetCollection.Remove 方法

定義

從集合中移除一個 ClientTarget 物件。

多載

名稱 Description
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

範例

以下程式碼範例將物件從集合中移除。ClientTargetClientTargetCollection

關於如何取得集合的資訊,請參閱課程總覽中的 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要移除。

範例

以下程式碼範例將物件從集合中移除。ClientTargetClientTargetCollection

關於如何取得集合的資訊,請參閱課程總覽中的 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 結構中父組態檔案中定義的元素參考,但不會刪除該元素。

另請參閱

適用於