Search code examples
vb.netbyrefbyvalparamarrayturbo-basic

Using ParamArray ByRef


Is there any way to use ParamArray ByRef? Barring that, it there a workaround that accomplishes the same thing?

I could do some overloads, but I am trying to avoid the clunkiness.

Background: Porting over some old code, and trying to keep the same structure as much as possible.


EDIT

A specific example of what I want:

I have some code in turboBasic that I am porting to vb.net. The code has built in functions such as

Input#1,Data$(I%,1),Data$(I%,2),Data$(I%,3)

Where Input() gets file # 1 and reads three pieces of data from it and assigns it to the three variables shown. I would like to replicate this behavior with my own Input() function. To do that, how would I take in three(or more, or less) variables and assign values to them?

Ideally I would accomplish this by only modifying my own definition of Input(), so I can muck in the code base as little as possible.


Solution

  • I've never used TurboBasic but the syntax looks identical to the VB6 Input# statement, so I'm guessing the semantics are also the same.

    This VB6 code

    Input #1,Data$(I%,1),Data$(I%,2),Data$(I%,3)
    

    Is equivalent to this VB.Net

    Input(1,Data$(I%,1))
    Input(1,Data$(I%,2))
    Input(1,Data$(I%,3))
    

    The VB.Net upgrade wizard converts the VB6 Input # statement like this. I would just port the code like this, rather than implementing your own function. Converting from VB6 to VB.net requires substantial edits in the code base, I would expect TurboBasic to be even more demanding.