对象的矢量即时VBNet
Vector of an object instant VB Net
我在VBNET中遇到向量问题。
我用C++写了一段代码
typedef struct
{
int process;
int burstTime;
int ArrivalTime;
int remaining;
int timeAddedToQ;
bool flag;
} process;
vector<process> proc;
如何在VBNET代码中表示这个C++代码?
我试着在谷歌上搜索,但没有任何帮助。如果有人能帮助,我会非常感激
感谢
您通常会为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)
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)
相关文章:
- 什么时候调用组成单元对象的析构函数
- 对RValue对象调用的LValue ref限定成员函数
- CMake-按正确顺序将项目与C运行时对象文件链接
- 空基优化子对象的地址
- 将对象数组的引用传递给函数
- 你能重载对象变量名本身返回的内容吗
- C++使用整数的压缩数组初始化对象
- 找不到成员对象:没有名为get_event()的成员,也处理多态性和向量
- 将对象移动到std::shared_ptr
- 代理对象的常量正确性
- 提升 ASIO 无法识别计时器对象
- 将Ref对象作为类成员
- 将包含C样式数组的对象初始化为成员变量(C++)
- 如何返回一个类的两个对象相加的结果
- 使用std::函数映射对象方法
- 是否需要删除包含对象的"pair"?
- 如何在自删除后将对象设置为nullptr
- 迭代时从向量和内存中删除对象
- 构造对象的歧义
- 对象的矢量即时VBNet