我在VB NET中遇到了矢量问题。
我用C ++写了一段代码
typedef struct
{
int process;
int burstTime;
int ArrivalTime;
int remaining;
int timeAddedToQ;
bool flag;
} process;
vector<process> proc;
如何在VB NET代码中表示此C ++代码?
我尝试搜索Google,但没有任何帮助。如果有人可以提供帮助,真的会让人感到沮丧
谢谢
答案 0 :(得分: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)
答案 1 :(得分: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
但是你应该确定you want a structure and not a class。
vector
没有对VB的直接转换,但List<T>
可能是最接近的:
Dim proc As New List(Of process)