The base wwCollection class allows adding items as single items. The collection is purely accessed by a numeric indexer.
The collection internally manages an aItems array which can also be accessed directly for performance if necessary.
loCol = CREATEOBJECT("wwCollection")
loCol.Add("This is Item1")
loCol.Add("This is Item2")
? loCol.Count && 2
? loCol.Item(1) && This is Item1
? loCol.Item(2) && This is Item2
? loCol.aItems[1] && This is Item1
? loCol.aItems[2] && This is Item2
? loCol.Item(4) && .NULL.
loCol.Remove(2)
? loCol.Count && 1
Class Members
Member | Description | |
---|---|---|
Add |
Adds an item to the Collection. o.Add(Value) |
|
Clear |
Clears all of the collection's items. o.Clear() |
|
Find |
Finds an item by value. o.Find(lvItem) |
|
FindIndex |
Finds the first matching item in the array by its value and returns the index. If not found 0 is returned. o.FindIndex(lvItem) |
|
InsertAt |
Inserts an item at the specified index position. Items are inserted before the item specified. o.InsertAt(Position,Value) |
|
Item |
Returns an item from the collection by in integer index value. o.Item(Index, llThrowError) |
|
Remove |
Removes an item from the collection by its index value. o.Remove(Index, llRemoveByValue) |
|
Set |
Assigns a value to the collection by adding if it doesn't exist, or doing nothing if it already exists. o.Set(lvValue) |
|
UpdateItem |
Updates an item in the collection at a specific location. o.UpdateItem(lnIndex,lvValue) |
|
aItems[] |
The internally maintained array of items added. This array is one dimensional and contains only the values added. | |
Count |
The count of items in this collection. | |
RequireUniqueItems |
When .T. insures that all items in the collections are unique when added. |
© West Wind Technologies, 1996-2024 • Updated: 11/10/18
Comment or report problem with topic