just a quick question about an issue I am having in vb.
I need to create an array, then iterate through a string, adding the string value to the array only is it does not already exist, to produce an array of unique values.
The issue I am having is with the array.length operation – on a array that is nothing I am unable to retrieve the array length (0), as such I am unable to redimensionalise the array to be array length (must be array length as arrays are indexed from 0), providing me the ability to add the new value to the array and then continue the loop until all values have been checked to see if they exist within the array (using contains) and the value contain only unique values..
Been nipping my head for hours 🙂
Thanks
Martin
I must assume that you are working with VB.Net, so I will answer accordingly.
The answer you are literally looking for is:
However, starting with Net 3.5 you can use LINQ to reduce this function to one line: