gpt4 book ai didi

vb.net - 如何在 VB.NET 中将数组设置为值列表?

转载 作者:行者123 更新时间:2023-12-02 08:00:37 25 4
gpt4 key购买 nike

我无法弄清楚如何将数组设置为两组数字之一(稍后会有更多),我尝试的每种方法都会引发某种错误。我尝试将 case 语句内的数组调暗,但随后我无法在 For Each 中使用该数组,这使得这毫无值(value)......任何想法将不胜感激。

代码:

Dim HourArray() As Integer

Select Case CurrentShapeRow(ROW_PERIOD)
Case "ON", "2X16"
HourArray = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}
Case "2X8", "5X8"
HourArray = {0, 1, 2, 3, 4, 5, 22, 23}
Case Else
Throw New Exception(String.Format("Unhandled Period: {0}", CurrentShapeRow(ROW_PERIOD)))
End Select


For Each HourCount As Integer In HourArray()
'DO SOME STUFF HERE
Next

最佳答案

HourArray = New Integer() {1,2,3,4,5,6,7,8,9}

关于vb.net - 如何在 VB.NET 中将数组设置为值列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2602405/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com