array?

hajeeme

New member
Joined
Jan 15, 2010
Messages
4
Programming Experience
Beginner
Hey guys,

I'm calling a function that's supposed to return an array. Here's the code:

VB.NET:
Dim connectorsToEnroll() As TMSWebAPI.ConnectorInfo = CallWebService.StartEnrollment(sessionHandle, formRequestUser, tokenSerial, TMSWebAPI.EnrollmentDataUsage.UseNewEnrollmentData)
                    If connectorsToEnroll IsNot Nothing Then
                        Response.Write("connectorsToEnroll not Null<br>")
                        Response.Write(connectorsToEnroll.Length.ToString() + "<br>")
                        For Each cInfo As TMSWebAPI.ConnectorInfo In connectorsToEnroll
                            Response.Write(cInfo.ConnectorID)
                        Next
                    Else
                        Response.Write("connectorsToEnroll Null<br>")
                    End If

Just to clarify, StartEnrollment returns an array of type ConnectorInfo and then I try to loop over the returned array.


And here's the output:

connectorsToEnroll not Null
0

The array returned is not nothing, however, it's length is 0? What does this mean?


Being that I'm not proficient in VB.Net, it's highly likely that it's a syntax problem

Your assistance is greatly appreciated,
Aron-Zvi
 
The array returned is not nothing, however, it's length is 0? What does this mean?
It means the function returned an array object containing zero items. According to coding guidelines properties that return arrays should in case there are no elements return empty arrays rather than null references (Nothing in VB.Net), I guess that is sound advice for functions also.
 
Back
Top