OutputCacheProfileCollection.Add(OutputCacheProfile) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Adiciona um OutputCacheProfile objeto à coleção.
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)
Parâmetros
- name
- OutputCacheProfile
O nome do OutputCacheProfile objeto a adicionar à coleção.
Exceções
O OutputCacheProfile objeto já existe na coleção ou a coleção é apenas leitura.
Exemplos
O exemplo de código a seguir mostra como usar o Add método.
// 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
Observações
A coleção não pode conter um OutputCacheProfile objeto com o mesmo nome.