user1404780
user1404780

Reputation:

Array of an object function

I have a third party web service. With VB.Net, one of the parameters of the function I'm using accepts an array of MyObject. So if I wrote the code below, SomeFunction would work as expected.

    Dim myArr(0) As MyObject
    SomeFunction(myArr)

Since myArr could hold many elements I wanted to create a different function that would allow me to pass in the relevant element (0,1,2,3,4....) into SomeFunction, rather than passing in 0 (in this case manually).

I'm not sure how to do this. Could someone help here?

Upvotes: 0

Views: 105

Answers (1)

John Bustos
John Bustos

Reputation: 19574

I'm not sure I completely understand your question, but if you're trying to pass in a single value of your object rather than an array, have you tried something like:

Dim myArr1 As MyObject
Dim myArr1 As MyObject

   SomeFunction({myArr1})
   SomeFunction({myArr2})

Or, more specifically, in your case:

Dim myArr(100) As MyObject

   ... code ...
   SomeFunction({myArr(20)})

... Something along those lines??

I apologize if I didn't understand your question correctly.

Upvotes: 2

Related Questions