OutputCacheProfileCollection.Add(OutputCacheProfile) Method

Definition

Adds a OutputCacheProfile object to the collection.

C#
public void Add(System.Web.Configuration.OutputCacheProfile name);

Parameters

name
OutputCacheProfile

The name of the OutputCacheProfile object to add to the collection.

Exceptions

The OutputCacheProfile object already exists in the collection or the collection is read only.

Examples

The following code example shows how to use the Add method.

C#
// Execute the Add method.
System.Web.Configuration.OutputCacheProfile outputCacheProfile0 =
  new System.Web.Configuration.OutputCacheProfile("MyCacheProfile");
outputCacheProfile0.Location = 
    System.Web.UI.OutputCacheLocation.Any;
outputCacheProfile0.NoStore = false;

outputCacheProfiles.Add(outputCacheProfile0);

// Update if not locked.
if (!outputCacheSettings.IsReadOnly())
{
    webConfig.Save();
}

Remarks

The collection cannot contain a OutputCacheProfile object with the same name.

Applies to

Tuote Versiot
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also