ClientTargetCollection.Add(ClientTarget) Metod

Definition

Lägger till det angivna ClientTarget objektet i samlingen.

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)

Parametrar

clientTarget
ClientTarget

Att ClientTarget lägga till i samlingen.

Exempel

I följande kodexempel läggs ett ClientTarget objekt till i ClientTargetCollection samlingen.

Information om hur du hämtar samlingen finns i kodexemplet i klassöversikten ClientTargetCollection .


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

Kommentarer

Innan du lägger till ett klientmål i samlingen måste du skapa ett ClientTarget objekt och initiera dess Alias och UserAgent egenskaper.

Gäller för

Se även