[英]How to set a 2 dimensional array as a property?
I want to set a 2 dimensional array as a property but I keep getting multiple errors when I try. 我想设置一个二维数组作为属性,但我尝试时会遇到多个错误。
This is what I just tried. 这就是我刚刚尝试过的。 The comments are the errors.
评论是错误。
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
I'm sure the answer is really obvious, I'm new to vb.net. 我确定答案非常明显,我是vb.net的新手。
Use the type Integer(,)
for the property and setter parameter: 对属性和setter参数使用
Integer(,)
类型:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.