结构体无法初始化值,你可以用类实现,或者写一个构造函数,把值传进去。
Public Structure wheelmodel
Public ID As Short
Public swapway() As Short
Public start As Short
Public Sub New(ByVal Size As UShort) 'Size就是传入的数组的大小
swapway = New Short(Size) {}
End Sub
End Structure
调用的时候:
Dim x As wheelmodel = New wheelmodel(10)
Structure Book
End Structure