ASP Contents.Remove-metoden

Application-objekt referenshandbok

Contents.Remove-metoden tar bort ett objekt från Contents-kollektionen.

Syntax

Application.Contents.Remove(name|index)
Session.Contents.Remove(name|index)
Parameter Beskrivning
name Namn på det projekt som ska tas bort.
index Index för det projekt som ska tas bort.

Exempel för Application-objektet

Exempel 1

<%
Application("test1")=("First test")
Application("test2")=("Second test")
Application("test3")=("Third test")
Application.Contents.Remove("test2")
för varje x i Application.Contents
 Response.Write(x & "=" & Application.Contents(x) & "<br />")
nästa
%>

Utdata:

test1=First test
test3=Third test

Exempel 2

<%
Application("test1")=("First test")
Application("test2")=("Second test")
Application("test3")=("Third test")
Application.Contents.Remove(2)
för varje x i Application.Contents
 Response.Write(x & "=" & Application.Contents(x) & "<br />")
nästa
%>

Utdata:

test1=First test
test3=Third test

Exempel för Session-objektet:

Exempel 1

<%
Session("test1")=("First test")
Session("test2")=("Second test")
Session("test3")=("Third test")
Session.Contents.Remove("test2")
för varje x i Session.Contents
 Response.Write(x & "=" & Session.Contents(x) & "<br />")
nästa
%>

Utdata:

test1=First test
test3=Third test

Exempel 2

<%
Session("test1")=("First test")
Session("test2")=("Second test")
Session("test3")=("Third test")
Session.Contents.Remove(2)
för varje x i Session.Contents
 Response.Write(x & "=" & Session.Contents(x) & "<br />")
nästa
%>

Utdata:

test1=First test
test3=Third test

Application-objekt referenshandbok