Μέθοδος Contents.Remove του ASP
Ο μέθοδος Contents.Remove απομακρύνει ένα αντικείμενο από τη συλλογή Contents.
Γραμματική
Application.Contents.Remove(name|index) Session.Contents.Remove(name|index)
Παράμετροι | Περιγραφή |
---|---|
name | Το όνομα του αντικειμένου που πρέπει να διαγραφεί. |
index | Ο αριθμός索引 του αντικειμένου που πρέπει να διαγραφεί. |
Για παράδειγμα του αντικειμένου Application
Παράδειγμα 1
<% Application("test1")=("First test") Application("test2")=("Second test") Application("test3")=("Third test") Application.Contents.Remove("test2") για κάθε x σε Application.Contents Response.Write(x & "=" & Application.Contents(x) & "<br />") next %>
输出:
test1=First test test3=Third test
Παράδειγμα 2
<% Application("test1")=("First test") Application("test2")=("Second test") Application("test3")=("Third test") Application.Contents.Remove(2) για κάθε x σε Application.Contents Response.Write(x & "=" & Application.Contents(x) & "<br />") next %>
输出:
test1=First test test3=Third test
Για παράδειγμα του αντικειμένου Session:
Παράδειγμα 1
<% Session("test1")=("First test") Session("test2")=("Second test") Session("test3")=("Third test") Session.Contents.Remove("test2") για κάθε x στο Session.Contents Response.Write(x & "=" & Session.Contents(x) & "<br />") next %>
输出:
test1=First test test3=Third test
Παράδειγμα 2
<% Session("test1")=("First test") Session("test2")=("Second test") Session("test3")=("Third test") Session.Contents.Remove(2) για κάθε x στο Session.Contents Response.Write(x & "=" & Session.Contents(x) & "<br />") next %>
输出:
test1=First test test3=Third test