OutputCacheProfileCollection.Add(OutputCacheProfile) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Lägger till ett OutputCacheProfile objekt i samlingen.
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)
Parametrar
- name
- OutputCacheProfile
Namnet på det objekt som OutputCacheProfile ska läggas till i samlingen.
Undantag
Objektet OutputCacheProfile finns redan i samlingen eller så är samlingen skrivskyddad.
Exempel
I följande kodexempel visas hur metoden Add används.
// 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
Kommentarer
Samlingen får inte innehålla ett OutputCacheProfile objekt med samma namn.