當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


ASP Items用法及代碼示例

ASP Items Method用於返回Dictionary對象中當前所有項的數組。

用法:

DictionaryObject.Items

例:下麵的代碼演示了ASP Dictionary.Items方法。

ASP

<% 
dim dict,arr,i 
set dict=Server.CreateObject("Scripting.Dictionary") 
  
'Add values to the dictionary 
dict.Add "g","geeks"
dict.Add "c","coding" 
dict.Add "p","placements"
  
'Getting the items of the dictionary 
arr=dict.Items 
  
Response.Write("The values in the dictionary are:") 
  
'Looping through the items 
for i=0 to dict.Count-1 
  Response.Write("<br> Value:" & arr(i)) 
next 
  
set dict=nothing 
%>

輸出:

The values in the dictionary are:
Value:geeks
Value:coding
Value:placements

相關用法


注:本文由純淨天空篩選整理自ManasChhabra2大神的英文原創作品 ASP Items Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。