Class wwNameValueCollection

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 Item1
? loCol.Item("Item1")      && This is Item2

? 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
Custom
  wwCollection

Class Members

MemberDescription

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.

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 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-2018 • Updated: 11/10/18
Comment or report problem with topic