Application Contents 컬렉션

Contents 컬렉션은 스크립트 명령을 통해 응용 프로그램에 추가된 모든 항목을 포함합니다. Contents 컬렉션을 사용하여 응용 프로그램 영역이 주어진 항목의 목록을 얻거나 특정 항목을 작업 대상으로 지정할 수 있습니다. Remove 또는 RemoveAll 메서드로 컬렉션에서 항목을 삭제할 수도 있습니다.

구문

Application.Contents(Key)

매개 변수

Key
검색할 항목 이름을 지정합니다.

메서드

Contents.Remove 컬렉션에서 항목을 삭제합니다.
Contents.RemoveAll 컬렉션에서 모든 항목을 삭제합니다.

주의

Application.Contents 컬렉션은 <OBJECT> 태그를 사용하지 않고 응용 프로그램 수준에서 선언된 항목을 포함합니다. 이는 Application 선언을 통해 만들어진 스칼라 변수와 Server.CreateObject로 작성된 개체를 모두 포함합니다. 예를 들어, 아래 스크립트에서 strHello와 objCustom은 모두 Application.Contents 컬렉션의 구성원입니다.

<% 
 Application("strHello") = "Hello"
 Set Application("objCustom") = Server.CreateObject("MyComponent") %>

Application.Contents 컬렉션은 For...Each와 For...Next 구문을 지원합니다. 다음 스크립트에서는 Application.Contents 컬렉션을 반복하는 각 메서드를 보여 줍니다.

<%
  Application("strText1") = "1234567890"
  Application("strText2") = "ABCDEFGHIJ"
  Application("strText3") = "A1B2C3D4E5"
%>

<%
  For Each Key in Application.Contents
    Response.Write Key + " = " + Application(Key) + "<BR>"
  Next
%>

<%
  For intItem = 1 to Application.Contents.Count
    Response.Write CStr(intItem) + " = "  
    Response.Write Application.Contents(intItem) + "<BR>"
  Next
%>

ASP 예제의 ASP 응용 프로그램 작성 섹션에 Application.Contents 컬렉션을 사용하는 작업 예제 .asp 파일이 있습니다.


© 1997-2001 Microsoft Corporation. All rights reserved.