Méthode Remove de Contents ASP
La méthode Remove de Contents supprime un élément du jeu Contents.
Syntaxe
Application.Contents.Remove(name|index) Session.Contents.Remove(name|index)
Paramètres | Description |
---|---|
name | Nom de l'élément à supprimer. |
index | Index de l'élément à supprimer. |
Exemple pour l'objet Application
Exemple 1
<% Application("test1")=("Premier test") Application("test2")=("Deuxième test") Application("test3")=("Troisième test") Application.Contents.Remove("test2") for each x in Application.Contents Response.Write(x & "=" & Application.Contents(x) & "<br />") next %>
Sortie :
test1=First test test3=Third test
Exemple 2
<% Application("test1")=("Premier test") Application("test2")=("Deuxième test") Application("test3")=("Troisième test") Application.Contents.Remove(2) for each x in Application.Contents Response.Write(x & "=" & Application.Contents(x) & "<br />") next %>
Sortie :
test1=First test test3=Third test
Exemple pour l'objet Session :
Exemple 1
<% Session("test1")=("Premier test") Session("test2")=("Deuxième test") Session("test3")=("Troisième test") Session.Contents.Remove("test2") for each x in Session.Contents Response.Write(x & "=" & Session.Contents(x) & "<br />") next %>
Sortie :
test1=First test test3=Third test
Exemple 2
<% Session("test1")=("Premier test") Session("test2")=("Deuxième test") Session("test3")=("Troisième test") Session.Contents.Remove(2) for each x in Session.Contents Response.Write(x & "=" & Session.Contents(x) & "<br />") next %>
Sortie :
test1=First test test3=Third test