2

我对 VB NET 中的向量有疑问。

我用 C++ 写了一段代码

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

vector<process> proc;

如何在 VB NET 代码中表示此 C++ 代码?

我尝试搜索谷歌,但没有任何帮助。如果有人可以提供帮助,我会很感激

谢谢

4

2 回答 2

3

您通常会为Process信息创建一个类,然后用于List(Of Process)替换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)
于 2013-09-03T19:26:50.290 回答
2

VB中的结构声明如下:

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

但是,您应该确定您想要一个结构而不是一个类vector没有直接翻译到 VB,但List<T>可能是最接近的:

Dim proc As New List(Of process)
于 2013-09-03T19:29:35.697 回答