我想将2维数组设置为属性,但在尝试时我会遇到多个错误。
这就是我刚试过的。评论是错误。
Dim _magnitude(,) As Integer
Public Property magnitude() As Integer
Get
Return Me._magnitude 'Value of type '2-dimensional array of Integer' cannot be converted to 'Integer'
End Get
Set(ByVal value As Integer)
Me._magnitude = value 'Value of type 'Integer' cannot be converted to '2-dimensional array of Integer'
End Set
End Property
我确定答案非常明显,我是vb.net的新手。
答案 0 :(得分:2)
使用类型Integer(,)
作为属性和setter参数:
Dim _magnitude(,) As Integer
Public Property magnitude As Integer(,)
Get
Return Me._magnitude
End Get
Set(ByVal value As Integer(,))
Me._magnitude = value
End Set
End Property