About
The BetterArray class stores all arrays internally as Variant()
dynamically allocated arrays. It supports one-dimension, multi-dimension and jagged arrays. If you assign the Items
property a multi-dimension array, the class instance will first make a note that the array should be returned as a multi-dimension array and then convert it internally to a jagged array. This allows you to modify the shape, structure, order and contents of the array with ease using any of the built-in methods whilst still returning you a multi-dimension array.
The internal array inside the BetterArray
instance has its own capacity, which is separate from the length of the array which will be returned to you. Similar to the processes in C#’s ArrayList or GoLang’s append, each time the current internal capacity is reached it will be doubled. This should provide a small performance benefit over resizing the array each time a new element is added.
VBA Better Array was written using the excellent Rubberduck add-in. You don’t need Rubberduck to use VBA Better Array, but the project supports Rubberduck folder navigation, is written to follow the Rubberduck VBA style guide, and uses Rubberduck for the test runner for all included unit tests. If you want to run or add to the supplied unit tests yourself then you will need Rubberduck. If you’re writing VBA code I strongly recommend you should be using Rubberduck anyway.
VBA Better Array is free software; you can redistribute it and/or modify it under the terms of the MIT license for use in commercial or personal projects. See LICENSE for details.