Sdílet prostřednictvím


ClientTargetCollection.Add(ClientTarget) Metoda

Definice

Přidá zadaný ClientTarget objekt do kolekce.

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

Parametry

clientTarget
ClientTarget

Přidání ClientTarget do kolekce

Příklady

Následující příklad kódu přidá ClientTarget objekt do ClientTargetCollection kolekce.

Informace o tom, jak získat kolekci, najdete v příkladu kódu v přehledu ClientTargetCollection třídy.


// Create a new ClientTarget object.
clientTarget = new ClientTarget(
  "my alias", "My User Agent"); 
  
// Add the clientTarget to 
// the collection.
clientTargets.Add(clientTarget);

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

' Add the clientTarget to 
' the collection.
clientTargets.Add(clientTarget)

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

Poznámky

Před přidáním cíle klienta do kolekce musíte vytvořit ClientTarget objekt a inicializovat jeho Alias a UserAgent vlastnosti.

Platí pro

Viz také