| Topic:
ASP
Dictionary Object
The Dictionary object is used to store information in name/value pairs .
Comparing Dictionaries and Arrays:
- Keys are used to identify the items in a Dictionary object
- You do not have to call ReDim to change the size of the Dictionary object
- When deleting an item from a Dictionary, the remaining items will automatically shift up
- Dictionaries cannot be multidimensional, Arrays can
- Dictionaries have more built-in functions than Arrays
- Dictionaries work better than arrays on accessing random elements frequently
- Dictionaries work better than arrays on locating items by their content
Example
<%
Dim d Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "s","Secret"
d.Add "g","Gold"
d.Add "b","Ball"
d.Add "p","Pass"
Response.Write("The value of key gr is: " & d.Item("gr"))
%>
Output:
The value of key g is: Gold
|
|