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(VBRuntimeVariantValue, VBRuntimeVariantValue?, VBRuntimeVariantValue?, VBRuntimeVariantValue?)
Adds an item to the collection; the item is appended unless specified otherwise.
RuntimeSemanticsEvaluationResult StdCollectionClass__Add(VBRuntimeVariantValue item, VBRuntimeVariantValue? key = null, VBRuntimeVariantValue? before = null, VBRuntimeVariantValue? after = null)
Parameters
itemVBRuntimeVariantValueAn expression of any type that specifies the item to be added to the collection.
keyVBRuntimeVariantValue?A 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.beforeVBRuntimeVariantValue?An 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.afterVBRuntimeVariantValue?An 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(VBRuntimeVariantValue)
Retrieves a specific item either by position (index) or by key.
RuntimeSemanticsEvaluationResult StdCollectionClass__Item(VBRuntimeVariantValue index)
Parameters
indexVBRuntimeVariantValue
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(VBRuntimeVariantValue)
Removes an item from the collection.
RuntimeSemanticsEvaluationResult StdCollectionClass__Remove(VBRuntimeVariantValue index)
Parameters
indexVBRuntimeVariantValueThe 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.