I have a program where the user inputs a string. This strings length is always a multiple of 8.
So to convert the string I split the string every 8 characters into an array.
I do that with this code
Dim substrings = Enumerable.Range(0, input.Length \ 8).[Select](Function(i) input.Substring(i * 8, 8))
That works fine.
I can then type String.Join(" ", substrings) and it works like it should, it takes whatever the user entered and puts a space between every 8 characters.
However, if I try to do this:
Dim indexOfEntry
For Each e In substrings
indexOfEntry = Array.IndexOf(substrings, e)
Next
I get an error:
An unhandled exception of type 'System.InvalidCastException' occurred in DataCalculator.exe
Additional information: Unable to cast object of type 'WhereSelectEnumerableIterator`2[System.Int32,System.String]' to type 'System.Array'.
How can I fix this?