I definitely searched for this, but I can't find the answer, even though it seems so trivial.
I have a variable in ASP.NET that returns a string.
string[] arrayOfThings { get { return new string[] { ... } } }
And I have call to it in ASP
Dim someString
For Each someString In someClass.arrayOfThings
# Do Something with someString
Next
This does not work. It returns a 'Type Mismatch' Exception.
When I try to debug, IsArray(someClass.arrayOfThings) returns True, but it has no Count, no attributes, nothing. UBound(someClass.arrayOfThings) is 0, which is what I would expect since it only has 1 element in it. However, I'm unable to reference the element by someClass.arrayOfThings(0)
I'm new to ASP, but I can't figure out what I'm doing wrong. I so wish ASP was strongly typed.
Edit: I tried creating an Array with the same value, and compare it to what I get from arrayOfThings, and in the debugger window they look identical, but in one case I can loop through it and in the other, I cannot.
Just FYI, currently I have it working like this:
I have a variable in ASP.NET that returns a string.
string arrayOfThings { get { return String.Join(",", new string[] { ... }) } }
And then in ASP
Dim someString
For Each someString In Split(someClass.arrayOfThings, ",")
# Do Something with someString
Next
And this works.