VB to C# Conversion

  • Thread starter Thread starter T.J.'s News Info
  • Start date Start date
T

T.J.'s News Info

I have another question. I have run across the following code segment in a
VB program that I wish to convert to C#:

Type AlphaName
Betty as string
Carl as string
Dan as int
End Type

public valueTable () as AlphaName
.. . .
.. . .
.. . .

for x = 0 to max
. . .
. . .
. . .
valueTable(x).Betty = indata
valueTable(x).Carl = "My Data"
valueTable(x).Dan = x
next

It appears to me that the defined Type is being used something like a DSECT
(I am a mainframe bigot) to allow placement of data in a table? I can't find
in MS document anywhere how to migrate this same type of scheme to my C#
program?? Any help would be appreciated....Tom J.
 
T.J.'s News Info said:
I have another question. I have run across the following code segment in a
VB program that I wish to convert to C#:

Type AlphaName
Betty as string
Carl as string
Dan as int
End Type

public valueTable () as AlphaName
. . .
. . .
. . .

for x = 0 to max
. . .
. . .
. . .
valueTable(x).Betty = indata
valueTable(x).Carl = "My Data"
valueTable(x).Dan = x
next

It appears to me that the defined Type is being used something like a DSECT
(I am a mainframe bigot) to allow placement of data in a table? I can't find
in MS document anywhere how to migrate this same type of scheme to my C#
program?? Any help would be appreciated....Tom J.

This is just an array of a user-defined type.

Something like

/
class AlphaName
{
public string Betty;
public string Carl;
public int Dan;

}

.. . .

int max = 5;
AlphaName[] valueTable = new AlphaName[max];

for (int x = 0; x < max; x++)
{
valueTable[x] = new AlphaName();
valueTable[x].Betty = "ddd";
valueTable[x].Carl = "My Data";
valueTable[x].Dan = x;
}

David
 
Thanks Dave, I'll let you know how this works for me.
David Browne said:
T.J.'s News Info said:
I have another question. I have run across the following code segment in a
VB program that I wish to convert to C#:

Type AlphaName
Betty as string
Carl as string
Dan as int
End Type

public valueTable () as AlphaName
. . .
. . .
. . .

for x = 0 to max
. . .
. . .
. . .
valueTable(x).Betty = indata
valueTable(x).Carl = "My Data"
valueTable(x).Dan = x
next

It appears to me that the defined Type is being used something like a DSECT
(I am a mainframe bigot) to allow placement of data in a table? I can't find
in MS document anywhere how to migrate this same type of scheme to my C#
program?? Any help would be appreciated....Tom J.

This is just an array of a user-defined type.

Something like

/
class AlphaName
{
public string Betty;
public string Carl;
public int Dan;

}

. . .

int max = 5;
AlphaName[] valueTable = new AlphaName[max];

for (int x = 0; x < max; x++)
{
valueTable[x] = new AlphaName();
valueTable[x].Betty = "ddd";
valueTable[x].Carl = "My Data";
valueTable[x].Dan = x;
}

David
 
Back
Top