Share via


OutputCacheProfileCollection.Add(OutputCacheProfile) Metoda

Definice

OutputCacheProfile Přidá objekt do kolekce.

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

Parametry

name
OutputCacheProfile

Název objektu, který OutputCacheProfile se má přidat do kolekce.

Výjimky

Objekt OutputCacheProfile již v kolekci existuje nebo je kolekce jen pro čtení.

Příklady

Následující příklad kódu ukazuje, jak použít metodu Add .

// 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();
}
' Execute the Add method.
  Dim outputCacheProfile0 _
  As New System.Web.Configuration.OutputCacheProfile( _
  "MyCacheProfile")
  outputCacheProfile0.Location = _
  System.Web.UI.OutputCacheLocation.Any
  outputCacheProfile0.NoStore = _
  False

  outputCacheProfiles.Add(outputCacheProfile0)

' Update if not locked.
  If Not outputCacheSettings.IsReadOnly() Then
      webConfig.Save()
  End If

Poznámky

Kolekce nemůže obsahovat objekt se OutputCacheProfile stejným názvem.

Platí pro

Viz také