VB.net的结构体怎么一次性赋值,结构数组怎么一次性赋值?
1个回答
展开全部
一个简单的例子:
Dim a(3) As Integer = { 0, 1, 2 }**修改**既然有界数组不能初始化,就还缺(省)界数组试试嘛:
Dim a() As Integer = { 0, 1, 2 }
类型不匹配的错误估计是你的结构体缺少构造函数造成的。在你的quality_i结构体定义里面加一个构造函数,如下所示
Public Structure quality_i
Public nub As Integer
Public nae As String
Public Sub New(ub As Integer, ae As String)nub = ubnae = aeEnd SubEnd Structure然后以如下方式初始化:
Dim a(3) As Integer = { 0, 1, 2 }**修改**既然有界数组不能初始化,就还缺(省)界数组试试嘛:
Dim a() As Integer = { 0, 1, 2 }
类型不匹配的错误估计是你的结构体缺少构造函数造成的。在你的quality_i结构体定义里面加一个构造函数,如下所示
Public Structure quality_i
Public nub As Integer
Public nae As String
Public Sub New(ub As Integer, ae As String)nub = ubnae = aeEnd SubEnd Structure然后以如下方式初始化:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询