Question

This is the VB6 Code I have

Dim aBcls() As String
ReDim aBcls(0 To iCount, 0 To 1)
For i = 0 To iCount
    aBcls(i, 0) = Pick.Extract(sOutput, 1, i + 1)
    aBcls(i, 1) = Pick.Extract(sOutput, 2, i + 1)
Next i

I am not able to understand how to convert it to C# Code. Can someone please guide me on this?

Was it helpful?

Solution

The intent of the VB6 code is to have an array that contains two strings, aka a multi-dimensional array of strings. You can do this either exactly or using a single dimensional array of objects that have two strings (class, struct or tupple).

I would tend towards using using a 1-dimensional array of a class of objects with two strings, unless that conflicts with usage elsewhere.

Note that it uses redim, which you can't do with MD arrays, but from your snippet that was unnecessary. If it is neccesary, you might want to see if you can use a list instead.

Also note that VB6 used ByRef by default, so sOutput could conceivably be changed by pick.extract.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top