ClientTargetCollection.Add Method (ClientTarget)

 

Adds the specified ClientTarget object to the collection.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

public void Add(
	ClientTarget clientTarget
)

Parameters

clientTarget
Type: System.Web.Configuration.ClientTarget

The ClientTarget to add to the collection.

Before adding a client target to the collection, you must create a ClientTarget object and initialize its Alias and UserAgent properties.

The following code example adds a ClientTarget object to the ClientTargetCollection collection.

For information about how to get the collection, see to the code example in the ClientTargetCollection class overview.


// 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();

.NET Framework
Available since 2.0
Return to top
Show: