最新的Web开发教程
 

ASP Contents.Remove方法


<完成申请对象参考

该Contents.Remove方法删除从内容集合的项目。

句法

Application.Contents.Remove(name|index)

Session.Contents.Remove(name|index)

参数 描述
name 该项目的名称以去除
index 该项目的索引中删除

应用程序对象实例

实施例1

<%
Application("test1")=("First test")
Application("test2")=("Second test")
Application("test3")=("Third test")

Application.Contents.Remove("test2")

for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br>")
next
%>

Output:

test1=First test
test3=Third test

实施例2

<%
Application("test1")=("First test")
Application("test2")=("Second test")
Application("test3")=("Third test")

Application.Contents.Remove(2)

for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br>")
next
%>

Output:

test1=First test
test3=Third test

对于Session对象实例

实施例1

<%
Session("test1")=("First test")
Session("test2")=("Second test")
Session("test3")=("Third test")

Session.Contents.Remove("test2")

for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>

Output:

test1=First test
test3=Third test

实施例2

<%
Session("test1")=("First test")
Session("test2")=("Second test")
Session("test3")=("Third test")

Session.Contents.Remove(2)

for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>

Output:

test1=First test
test3=Third test

<完成申请对象参考