A special collection that allows key and value pairs to be stored and retrieved by the key name or index.
This class manages the Collection in a two dimensional array aItems which contains key and value in the first and second columns respectively.
loCol = CREATEOBJECT("wwNameValueCollection")
loCol.Add("Item1","This is Item1")
loCol.Add("Item2","This is Item2")
? loCol.Count && 2
? loCol.Item("Item2") && This is Item2
? loCol.Item("Item1") && This is Item1
? loCol.aItems["Item2",2] && This is Item1
? loCol.aItems["Item1",2] && This is Item2
? loCol.Item("ItemBOGUS") && .NULL.
? loCol.GetIndex("Item2") && 2
? loCol.GetKey(2) && Item2
loCol.Remove("Item1")
? loCol.Count && 1
wwCollection
Class Members
Member | Description | |
---|---|---|
Add |
Adds an item to the collection. The value can be added either just by adding the value, or by adding a key and value combination. This method updates an existing item with the same key. o.Add(Key,Value) |
|
Clear |
Clears the collection of all items. o.Clear() |
|
FastAdd |
o.FastAdd(Key,Value) |
|
Get |
o.Get(lvKey) |
|
GetIndex |
Retrieves an index value from a key. o.GetIndex(Key) |
|
GetKey |
Returns the key for a specified index into the collection. o.GetKey(Index) |
|
InsertAt |
Inserts an item at the specified index position. Items are inserted before the item specified. o.InsertAt(Position,Key,Value) |
|
Item |
Returns an item's value out of the collection either by index or by string key. Note if you want both the key and value returned as an object use the Get() method. o.Item(Key) |
|
Remove |
Removes an item out of the collection by index or key. o.Remove(Key) |
|
ToAttributeString |
o.ToAttributeString(lcSeparator) |
|
UpdateItem |
Updates an item in the collection with a new value. o.UpdateItem(lvKey, lvValue) |
|
aItems[] |
The internally maintained two-dimensional array of items added. This array is two dimensional and contains the Key in the first column and the Value in the second. |
|
Count |
The count of items in this collection. |
© West Wind Technologies, 1996-2024 • Updated: 12/17/18
Comment or report problem with topic