Useful Code snipptes - VBScript
VBScript data structures Vbscript lacks support of complex data structures unlike other programming languages. This sometimes make life a bit difficult. We need to code our own algorithms to achieve simple tasks like sorting of an array or reversing it. .net has support for complex data structures which come with build-in functions for these simple tasks. So if we can use .net data structure then we can save reinvention of wheel for some of these tasks. Well the good news is some of .net libraries are exposed to COM and can be used in vbscript. Below are some examples: ArrayList: Set objArrayList = CreateObject("System.Collections.ArrayList") objArrayList.Add 6 objArrayList.Add 8 objArrayList.Add 2 objArrayList.Add 4 objArrayList.Add 1 objArrayList.Add 5 objArrayList.Add 3 objArrayList.Add 3 objArrayList.Add 7 'unlike redefining array size (redim statement) every time before appending an element into an array, ' with arraylist you don’t need t