Interface IStdCollectionClass
MS-VBAL 6.1.3.1 Collection Class
public interface IStdCollectionClass
Remarks
Formalizes the public interface of the Collection class.
Methods
StdCollectionClass__Add(VBVariantValue, VBVariantValue?, VBVariantValue?, VBVariantValue?)
Adds an item to the collection; the item is appended unless specified otherwise.
RuntimeSemanticsEvaluationResult StdCollectionClass__Add(VBVariantValue item, VBVariantValue? key = null, VBVariantValue? before = null, VBVariantValue? after = null)
Parameters
itemVBVariantValueAn expression of any type that specifies the item to be added to the collection.
keyVBVariantValueA VBStringValue that is unique across all keys in the collections. Can be used in place of a positional index to access an item in the collection.
💥KeyAlreadyAssociatedWithAnElementOfCollection if the specified key is already in use.beforeVBVariantValueAn expression that specifies a relative position in the collection; the item to be added is placed before the item identified by this parameter.
💥InvalidProcedureCallOrArgument if both before and after optional parameters are specified, or if they refer to non-existing items.afterVBVariantValueAn expression that specifies a relative position in the collection; the item to be added is placed after the item identified by this parameter.
💥InvalidProcedureCallOrArgument if both before and after optional parameters are specified, or if they refer to non-existing items.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
👉 Object collections want to be enumerated, not indexed. Indexed access within a loop should raise some performance-related semantic flags.
StdCollectionClass__Count()
Returns the number of items in the collection.
RuntimeSemanticsEvaluationResult StdCollectionClass__Count()
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
StdCollectionClass__Item(VBVariantValue)
Retrieves a specific item either by position (index) or by key.
RuntimeSemanticsEvaluationResult StdCollectionClass__Item(VBVariantValue index)
Parameters
indexVBVariantValue
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
👉 Object collections want to be enumerated, not indexed. Indexed access within a loop should raise some performance-related semantic flags.
StdCollectionClass__Remove(VBVariantValue)
Removes an item from the collection.
RuntimeSemanticsEvaluationResult StdCollectionClass__Remove(VBVariantValue index)
Parameters
indexVBVariantValueThe key or positional index of the item to be removed.
💥MethodOrDataMemberNotFound if no item exists at the specified positional index or with the specified key.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.