ClientTargetCollection.Remove 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從集合中移除一個 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 結構中父組態檔案中定義的元素參考,但不會刪除該元素。