2

I have problem with vector in VB NET.

I have written a code in C++

typedef struct
{
    int process;
    int burstTime;
    int ArrivalTime;
    int remaining;
    int timeAddedToQ;
    bool flag;
} process;

vector<process> proc;

How can I represent this C++ code in VB NET code?

I tried searching Google but nothing helped. Will really apreciate if anyone can help

Thanks

2 Answers2

3

You would typically make a class for the Process information, then use List(Of Process) to replace the vector<process>.

Public Class Process
    Property Process As Integer
    Property BurstTime As Integer
    Property ArrivalTime As Integer
    Property Remaining As Integer
    Property Flag as Boolean
End Class

' Use in code as:
Dim proc as New List(Of Process)
Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
2

Structures in VB are declared as follows:

Public Structure process
    Public process As Integer 
    Public burstTime As Integer
    Public ArrivalTime As Integer
    Public remaining As Integer
    Public timeAddedToQ As Integer
    Public flag As Boolean
End Structure

However you should be certain you want a structure and not a class. vector does not have a direct translation to VB, but List<T> is probably the closest:

Dim proc As New List(Of process)
Community
  • 1
  • 1
D Stanley
  • 149,601
  • 11
  • 178
  • 240